<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Advanced CSS Design Resources - last-child.com &#187; background</title>
	<atom:link href="http://www.last-child.com/category/css/background/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.last-child.com</link>
	<description>CSS Toys for Professional Web Developers</description>
	<lastBuildDate>Mon, 14 Sep 2009 16:12:54 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Adding style to your rel attributes with CSS</title>
		<link>http://www.last-child.com/rel-attribute-display/</link>
		<comments>http://www.last-child.com/rel-attribute-display/#comments</comments>
		<pubDate>Wed, 25 Jun 2008 15:03:00 +0000</pubDate>
		<dc:creator>Ted</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS2]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[Image Sprites]]></category>
		<category><![CDATA[Link]]></category>
		<category><![CDATA[W3C]]></category>
		<category><![CDATA[attribute selector]]></category>
		<category><![CDATA[background]]></category>
		<category><![CDATA[microformats]]></category>
		<category><![CDATA[attribute]]></category>
		<category><![CDATA[Cascading Style Sheets]]></category>
		<category><![CDATA[Data Formats]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[rel]]></category>
		<category><![CDATA[xfn]]></category>

		<guid isPermaLink="false">http://www.last-child.com/?p=153</guid>
		<description><![CDATA[View the finished example: Adding style to your rel link.
There&#8217;s a little attribute in HTML links that is starting to get a bit of attention lately. The &#8220;rel&#8221; attribute is a sparsely defined attribute that applies some meta information about a link&#8217;s relationship to other documents. Unfortunately, this information is usually hidden from your users. [...]]]></description>
			<content:encoded><![CDATA[<p>View the finished example: <a href="/examples/rel-attribute/index.html">Adding style to your rel link</a>.</p>
<p>There&#8217;s a little attribute in HTML links that is starting to get a bit of attention lately. The &#8220;rel&#8221; attribute is a <a href="http://www.w3.org/TR/REC-html40/types.html#type-links">sparsely defined attribute</a> that applies some meta information about a link&#8217;s relationship to other documents. Unfortunately, this information is usually hidden from your users. Let&#8217;s take a light-hearted stab at turning it into a visual element.</p>
<h3>Rel attribute usage</h3>
<p>
While the W3C originally considered the rel attribute to describe the relationship of pages to each other, i.e. next, previous, directory, and start. The attribute has been adopted by the <a href="http://microformats.org">Microformat</a> community for its inherit usefulness. The rel attribute is now used for <a href="http://microformats.org/wiki/rel-tag">tags</a>, <a href="http://gmpg.org/xfn/">to define your relationship to someone</a>, and even to <a href="http://microformats.org/wiki/rel-nofollow">tell search engines not to bother following a link</a>. </p>
<p>
The opportunities to use the rel attribute are seemingly endless. There are more proposals to <a href="http://xen.adactio.com/">define people you don&#8217;t like</a> and <a href="http://microformats.org/wiki/vote-links">links for voting</a>.  </p>
<p>
But all of this flexibility comes at a small price. To remain valid, you need to tell the browser what these new rel values may actually mean. This is handled by <a href="http://microformats.org/wiki/profile-uris">linking to appropriate profiles</a>. Just simply insert the profiles into your head tag. <a href="http://microformats.org/wiki/profile-uris#Combined_Profile">Multiple profiles</a> may throw a validation error, but it&#8217;s ok.  You don&#8217;t need to do this for the standard rel values.</p>
<p><code lang="HTML"><br />
<head profile="http://www.ietf.org/rfc/rfc2731.txt http://www.w3.org/2006/03/hcard"><br />
</code></p>
<p>
We will be using the CSS3 attribute selector functionality to look at the value of the rel attribute and apply some style accordingly. First we&#8217;ll add some padding and a background image to any link that has a rel attribute. We&#8217;ll then use background positioning to display an icon that is appropriate for the link. It&#8217;s a fairly simple hack. </p>
<p>For more information on using attribute selectors, check out my previous posts: </p>
<ul>
<li><a href="/css-attribute-selector/">Progressive enhancement of links using the CSS attribute selector</a></li>
<li><a href="/attribute-selectors-to-provide-language-information/">Attribute selectors to provide language information</a></li>
</ul>
<h3>Sample HTML Code</h3>
<p><code lang="HTML"></p>
<li><a href="http://microformats.org/wiki/rel-nofollow" rel="no-follow">This link is ignored by search engines</a> (rel="no-follow")</li>
<li><a href="http://microformats.org/wiki/rel-tag" rel="tag">A sample tag </a> (rel="tag")</li>
<p></code></p>
<h3>Sample CSS </h3>
<p><code lang="CSS"><br />
a[rel] {padding-left:20px; background:url(rel-sprite.png) no-repeat 0 0; }<br />
a[rel~="help"] {background-position: 0 -350px ;}<br />
a[rel~="license"] {background-position: 0 -1347px ;}<br />
a[rel~="no-follow"] {background-position: 0 -1200px ;}<br />
a[rel~="tag"] {background-position: 0 -47px ;}<br />
</code></p>
<h3>It&#8217;s all fun and games</h3>
<p>
I&#8217;ll be the first to admit this exercise has significant issues. I&#8217;m assuming the following elements are true:</p>
<ol>
<li>All possible rel attribute values are accounted for in my CSS, if not there will be a blank space generated by the first rule</li>
<li>You can only have one relationship defined by XFN. Unfortunately, most people are defined by multiple values, i.e. rel=&#8221;met friend colleague&#8221;. This CSS does not account for multiple values. </li>
</ol>
<p>So, the display of your rel attributes may be a bit off in the edge cases. Keep the spirit light and nobody will say anything&#8230; I hope. Have fun with your rel attributes. They&#8217;re just sitting there waiting to be used. </p>
<p><a href="/examples/rel-attribute/index.html">View the finished rel attribute style example</a>.</p>
<h3>Related Information</h3>
<ul>
<li>Microformats Wiki: <a href="http://microformats.org/wiki/profile-uris#Combined_Profile">Profile URI&#8217;s</a></li>
<li>Microformat: <a href="http://microformats.org/wiki/rel-design-pattern">Rel Design Pattern</a></li>
<li>Microformat: <a href="http://microformats.org/wiki/rel-tag">Tags</a></li>
<li>Microformat: <a href="http://microformats.org/wiki/rel-no-follow">No Follow</a></li>
<li>Microformat: <a href="http://microformats.org/wiki/rel-bookmark">Bookmark</a></li>
<li>Microformat: <a href="http://gmpg.org/xfn/">XFN &#8211; Friends Network</a></li>
<li>Microformat: <a href="http://xen.adactio.com/">XEN &#8211; Enemies Network</a></li>
<li>W3C: <a href="http://www.w3.org/TR/REC-html40/types.html#type-links">Link Types</a></li>
<li><a href="http://www.iconbuffet.com/">Icon Buffet</a> &#8211; The source of most icons used in this example</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.last-child.com/rel-attribute-display/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Image sprites &#8211; flexible and accessible packages</title>
		<link>http://www.last-child.com/image-sprites-flexible-and-accessible-packages/</link>
		<comments>http://www.last-child.com/image-sprites-flexible-and-accessible-packages/#comments</comments>
		<pubDate>Tue, 17 Oct 2006 20:11:11 +0000</pubDate>
		<dc:creator>Ted</dc:creator>
				<category><![CDATA[Accessibility]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Class]]></category>
		<category><![CDATA[Definition List]]></category>
		<category><![CDATA[HTML Elements]]></category>
		<category><![CDATA[Image Replacement]]></category>
		<category><![CDATA[Image Sprites]]></category>
		<category><![CDATA[Span]]></category>
		<category><![CDATA[Yahoo!]]></category>
		<category><![CDATA[background]]></category>
		<category><![CDATA[position]]></category>

		<guid isPermaLink="false">http://www.last-child.com/image-sprites-flexible-and-accessible-packages/</guid>
		<description><![CDATA[ User  generated ratings and reviews are an important part of all Yahoo! sites. You can find them on  just about every page of Yahoo! Tech.&#160; It  was important for us to develop a ratings presentation device that was easy to code,  accessible, flexible, and as light-weight as possible. Our final [...]]]></description>
			<content:encoded><![CDATA[<p> User  generated ratings and reviews are an important part of all Yahoo! sites. You can find them on  just about every page of <a href="http://tech.yahoo.com">Yahoo! Tech</a>.&nbsp; It  was important for us to develop a ratings presentation device that was easy to code,  accessible, flexible, and as light-weight as possible. Our final design  uses a combination of image sprites and negative text-indent to satisfy these requirements.</p>
<p>
Product ratings are represented with 1 to 5 stars. Other sites  have used inline images; repeating a solid or empty version for each of the  five stars. <img src="http://us.i1.yimg.com/us.yimg.com/i/us/sh/karma/ar_star_4half.gif" alt="stars image from Yahoo! Shopping" width="93" height="16" />Other sites, such as Yahoo! Shopping, have used a single inline image representing the number of  stars.&nbsp;  At best, the image will have an alt attribute that descibes the number of stars. However, the content is locked inside the image. This is an easy approach for  coding but isn&rsquo;t the most accessible approach. </p>
<h3>Yahoo! Tech uses the <strong>content first</strong> approach to design</h3>
<p>
Content-first design improves accessibility. This approach places the relevant content in semantic markup. It then uses CSS to transform that content into the visual design. Here is a sample rating from Yahoo! Tech: <strong>Overall:4/5, Quality:5/5, Support: 3/5</strong>. Our CSS transform that simple text into a series of stars and accompanying text. User testing with a screen-reader user led us to remove visual descriptions from the content, i.e.&quot;stars&quot; or &quot;bars&quot;. </p>
<h3>With the content in the page, it was time to look at the visual design. </h3>
<p>Ratings are presented in either an unordered list or definition list. We need to place descriptive text in front of the stars and want the stars to be aligned with each other. These considerations lead to using spans with a combination of CSS rules to hide the text, insert a background image, and absolutely position the ratings to the right side of the list item.  <strong>Let&rsquo;s look at the code.</strong></p>
<h4>The HTML &#8211; span </h4>
<p>
To use  a background image for the stars, we  need a container that can be manipulated with CSS and not include presentational behaviors  of its own. This is why we  use the span, a generic inline container.  We could  use a strong or em, but feel the span offers the best  versatility. You never know when the graphic designer will ask for some text to be bolded or emphasized in the same list item. </p>
<h4>Sample code for a rating</h4>
<p><code lang="HTML"></p>
<ul class="ratingslist">
<li class="stars4">Overall: <span title="Yahoo! users gave the Apple iPod 4 out of 5 stars for Overall Quality">4/5</span></li>
</ul>
<p></code></p>
<p>
The span&rsquo;s title will generate a tooltip when the user places their mouse over the rating (not Internet Explorer). Screen readers&#8217; default settings ignore title attributes on non-form items.</p>
<h4>The CSS</h4>
<p>
Spans are inline elements.&nbsp;  To display background images, we need to make them display block, define  a height, width, and move the text off the screen. To keep them inline with the  text, we are also positioning them absolutely. We could  position them relatively or floated the spans. Position absolute works the best for our pages.The parent list item is positioned  relatively to give the span a contextual anchor. Negative text-indent will hide the rating text.</p>
<p><code lang="CSS"><br />
.ratingslist {list-style-type:none;}<br />
.ratingslist li {position:relative;  padding:3px 5px; }<br />
.ratingslist li span {text-indent:-1000em; width:66px;  display:block; position:absolute;  top:5px; right:20px;}<br />
</code></p>
<h4>Image sprites display the desired number of stars</h4>
<p>
The list item is given a class with a number at the end  (stars8). This will display an image with four out of five red stars. We are using a scale of 0 to 10 to accomodate half stars. To  display other rating variations, we change the modifier, i.e. prostars4,  retstars4, bars4, bigstars4, etc&hellip;</p>
<p>
To simplify the maintenance of the site and  reduce server  requests; Yahoo! Tech also uses image sprites. Sprites are <a href="http://l.yimg.com/tech.yahoo.com/images/20061004202215/bg-ratings.png">single images that include multiple icons</a> with a consistent spacing between them. Use background positioning to display the desired chunk of the image. Each sprite represents the  possible color variations used on the site: red, blue, and green. Minimizing the  color palettes reduces the final image size.  For more  information on sprites, read <a href="http://www.alistapart.com/articles/sprites/">CSS Sprites: Image Slicing&rsquo;s Kiss of Death</a> by Dave Shea. As a further enhancement, alpha transparent png images are  used for most browsers and index-transparent gifs are presented in the Internet  Explorer 6  style sheets.&nbsp;</p>
<p>
Background images are positioned with the set of numbers after &quot;no repeat.&quot; The horizontal positioning is first. Our sprite is vertical, so we are leaving it alone, hence the 0 value. The vertical positiong comes next. If we want to display 2 out of 5 stars, we need to shift the background down to that part of the image (-530px). Here is the CSS for presenting the specific star variant.</p>
<p><code lang="CSS"><br />
/* Ratings images<br />
  ======================================= */<br />
  .stars0 span {background:url(/images/bg-ratings.png)  no-repeat 0 -650px;}<br />
  .stars1 span {background:url(/images/bg-ratings.png)  no-repeat 0 -620px;}<br />
  .stars2 span {background:url(/images/bg-ratings.png)  no-repeat 0 -590px;}<br />
  .stars3 span {background:url(/images/bg-ratings.png)  no-repeat 0 -560px;}<br />
  .stars4 span {background:url(/images/bg-ratings.png)  no-repeat 0 -530px;}<br />
  .stars5 span {background:url(/images/bg-ratings.png)  no-repeat 0 -500px;}<br />
  &hellip; (repeated for each variation of the stars and bars)<br />
</code></p>
<p>
This approach has allowed the Yahoo! Tech engineers  to maintain a consistent presentation  with minimal  markup. For pages that need special tweaks we can easily adjust the positioning  by using descending selectors: </p>
<p><code lang="CSS"><br />
#mytech .ratingslist li span { right:5px;}<br />
</code></p>
<h4>Caveats</h4>
<p>
We&rsquo;ve only found a few small issues with this approach. </p>
<ul >
<li>You cannot count on background images being displayed on the printed page. Our print style sheet removes the text-indent and background images to display &ldquo;Overall: 4/5&rdquo;. </li>
<li>When       someone includes more than 4 products in the comparison table, the text of some rating parameters will begin to overlap the stars. If they were inline images or if we floated the spans, they may drop to the next line. </li>
</ul>
<p>
Yahoo Tech! ratings are another example of creating  accessible and visually dynamic pages by considering the underlying content  structure before attacking the styles. Users of all abilities are presented  with solid information. That&rsquo;s how you can deliver a 5 star page every time.</p>
<p>Related Information</p>
<ul>
<li> <a href="http://www.alistapart.com/articles/sprites/">CSS Sprites: Image Slicing&rsquo;s Kiss of Death</a> by Dave Shea.</li>
<li><a href="/make-flash-accessible-to-screen-readers-in-transparent-window-mode/">Making Flash Accessible to Screen Readers</a></li>
<li><a href="http://rollyo.com/search.html?q=sprites&#038;uid=0&#038;sid=4886">Standardista Search: Sprites</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.last-child.com/image-sprites-flexible-and-accessible-packages/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>IE7 background sprite bug &#8211; the saga continues</title>
		<link>http://www.last-child.com/ie7-background-sprite-bug-the-saga-continues/</link>
		<comments>http://www.last-child.com/ie7-background-sprite-bug-the-saga-continues/#comments</comments>
		<pubDate>Thu, 08 Jun 2006 17:13:39 +0000</pubDate>
		<dc:creator>Ted</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Hacks]]></category>
		<category><![CDATA[IE7]]></category>
		<category><![CDATA[Image Sprites]]></category>
		<category><![CDATA[background]]></category>
		<category><![CDATA[position]]></category>

		<guid isPermaLink="false">http://www.last-child.com/ie7-background-sprite-bug-the-saga-continues/</guid>
		<description><![CDATA[I&#8217;ve been able to narrow down my problem with IE7b2 and background sprites. However, I still have not been able to create a stripped down test page that consistently mis-behaves. So my observations, while not scientific, could save you some hours of debugging.
Internet Explorer 7beta2 is not treating transparent png background images correctly. It sees [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been able to narrow down <a href="http://www.last-child.com/ie7-measuring-sprites-from-bottom-up/">my problem with IE7b2 and background sprites</a>. However, I still have not been able to create a stripped down test page that consistently mis-behaves. So my observations, while not scientific, could save you some hours of debugging.</p>
<p>Internet Explorer 7beta2 is not treating transparent png background images correctly. It sees &#8220;background-position: 0 0&#8243; as &#8220;background-position: 0 100%&#8221;. Come to think of it, I have only tried a vertical sprite, this may be the same for a horizontal sprite. </p>
<h3>What&#8217;s the solution? </h3>
<p>You could create a series of rules in your IE7 style sheet to measure your new sprites from the bottom up, instead of top down. But this doesn&#8217;t solve some of the other odd issues with IE7 and transparent png images. I&#8217;ve seen the images load upside down and I&#8217;ve seen the images move when you scroll the page and the image hits the bottom of the browser. I thought I was going crazy or that I had some sort of mutated version. But this pseudo-animation works on other computers. </p>
<p>Our IE6 style sheet replaces our pretty alpha transparent png graphics with a simpler index transparent gif version. We replaced our re-measured rules in the IE7 with this set and it has solved our problems. It would be great to take advantage of IE7&#8217;s ability to use alpha transparent png images, but this bug is just driving me nuts.  I&#8217;ve also been in contact with the IE7 team. They are dedicated to building the best browser possible within their constraints and hopefully this will be figured out before the final launch of IE7. </p>
<p>One other note of advice. Creating alpha transparent png images via the save as command in Photoshop on a Mac gave us the worst results. Those images did some very funky things on the page. Fireworks created better images.</p>
<h3>c&#8217;est fini!</h3>
<p><del>I don&#8217;t know if it is official or not, but I can say that the Microsoft engineers are interested in what developers have to say and have worked on this bug. I believe it has been fixed and will be all good to go with the final release of IE7. I can&#8217;t confirm or deny this, but I am pleased with their response to my initial post and followup.</del><ins>This bug has officially been officially fixed as of Release Candidate 1 and you can use your transparent png sprites without a worry in the world!</ins></p>
]]></content:encoded>
			<wfw:commentRss>http://www.last-child.com/ie7-background-sprite-bug-the-saga-continues/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>IE7 passes the sprite test</title>
		<link>http://www.last-child.com/ie7-passes-the-sprite-test/</link>
		<comments>http://www.last-child.com/ie7-passes-the-sprite-test/#comments</comments>
		<pubDate>Sun, 07 May 2006 17:45:55 +0000</pubDate>
		<dc:creator>Ted</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[IE7]]></category>
		<category><![CDATA[Image Sprites]]></category>
		<category><![CDATA[Quick Tips]]></category>
		<category><![CDATA[background]]></category>
		<category><![CDATA[position]]></category>

		<guid isPermaLink="false">http://www.last-child.com/ie7-passes-the-sprite-test/</guid>
		<description><![CDATA[
I came across an issue with Internet Explorer 7 beta displaying the rating stars incorrectly in Yahoo! Tech.  After doing some testing, I realized the browser was measuring the sprite image from the bottom up, rather than the top down. This is a significant issue. I had to create a new set of rules [...]]]></description>
			<content:encoded><![CDATA[<p><img id="image61" src="http://www.last-child.com/wp-content/uploads/2006/05/beegee-sprite-thumb.jpg" alt="beegee sprite thumb" /><br />
I came across an issue with Internet Explorer 7 beta displaying the rating stars incorrectly in <a href="http://tech.yahoo.com">Yahoo! Tech</a>.  After doing some testing, I realized the browser was measuring the sprite image from the bottom up, rather than the top down. This is a significant issue. I had to create a new set of rules in the IE7 style sheet for the new measurements.</p>
<p>I use sprites extensively. I love the way they save server requests and I think they are much easier to maintain. The thought of fixing all of my sprites was enough to send me downstairs for another coffee. But I noticed the only sprites being affected were the ratings. I needed to find what was special about these. The ratings sprites use a span that is absolutely positioned in either an unordered list or definition list. This gives us flexibility for displaying them across the site. </p>
<h3>IE7 Does it Right!</h3>
<p>I created a <a href="http://www.last-child.com/sprite-test-ie7.html">test page for using sprites</a>. I stripped the CSS down to simple list handling, floating, positioning, and sprite.  IE7 handled it perfectly. I even replaced the links with spans and that still didn&#8217;t trip up IE7.  Take a look at the test page , <a href="http://www.last-child.com/sprite-test-ie7.html">IE7 Sprite Test</a>, to see the results. While I&#8217;m still having problems with IE7&#8217;s handling of sprites. I believe it is a unique combination of styles that is causing this issue. I don&#8217;t think the average person will need to worry about this.</p>
<p>When I do figure out what is going on with Yahoo! Tech&#8217;s rating sprites, I&#8217;ll update this blog with the solution. For more information on using sprites, visit Dave Shea&#8217;s article <a href="http://www.alistapart.com/articles/sprites/">CSS Sprites: Image Slicing’s Kiss of Death</a>  on <a href="http://www.alistapart.com">A List Apart</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.last-child.com/ie7-passes-the-sprite-test/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>IE7 measuring sprites from bottom up?</title>
		<link>http://www.last-child.com/ie7-measuring-sprites-from-bottom-up/</link>
		<comments>http://www.last-child.com/ie7-measuring-sprites-from-bottom-up/#comments</comments>
		<pubDate>Wed, 03 May 2006 00:24:08 +0000</pubDate>
		<dc:creator>Ted</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Conditional Comment]]></category>
		<category><![CDATA[Hacks]]></category>
		<category><![CDATA[IE7]]></category>
		<category><![CDATA[Image Sprites]]></category>
		<category><![CDATA[background]]></category>

		<guid isPermaLink="false">http://www.last-child.com/ie7-measuring-sprites-from-bottom-up/</guid>
		<description><![CDATA[I&#8217;m doing some IE7 hacking and was wondering what was going on with some of my sprites. They look fine in all of the browsers except IE7. For that lovely browser, I say with my teeth clinched, I&#8217;m getting really strange results.  At first I thought it was a hasLayout issue, that I needed [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m doing some IE7 hacking and was wondering what was going on with some of my sprites. They look fine in all of the browsers except IE7. For that lovely browser, I say with my teeth clinched, I&#8217;m getting really strange results.  At first I thought it was a hasLayout issue, that I needed to do some messing around with the position:relative, or that it just didn&#8217;t like me.</p>
<p>However, while doing some troubleshooting, it looks like, <strong>please tell me I&#8217;m wrong</strong>, lE7 is measuring the sprite from the bottom up instead of the bottom down.</p>
<p>Here&#8217;s an example on <a href="http://tech.yahoo.com/pr/Apple-iMAC-G5-Desktop-Computer/1991804229">Yahoo! Tech</a>. You should see in the top product header 4 out of 5 blue stars for Pro Reviews and 5 out of 5 red stars for User Reviews. In IE7b, there are tiny nubbins from the tips of stars. </p>
<p><a href="http://us.tech5.yimg.com/tech.yahoo.com/images/20060430165459/bg-pro-ratings.png"> Here&#8217;s the background image (.png)</a> for the pro stars and the normal CSS for 4/5 stars:<br />
<code lang="CSS"><br />
.bigprostars4 span {width:100px; height:20px; top:0; background:url(/images/bg-pro-ratings.png) no-repeat 0 -50px;}<br />
</code></p>
<p>I began looking at the numbers, thinking they were off by a few pixels. After doing some testing of the positions, I realized that it was not measuring 50px down from the top, as other browsers handle sprites, but starting at the bottom of the image and measuring 50px up! Hence, displaying the tips of the small stars.</p>
<p>To fix this I added this style to the IE7.css (currently not live!) file:<br />
<code lang="CSS">.bigprostars4 span {width:100px; height:20px; top:0; background-position: 0 -400px;}</code></p>
<p>This is not a small issue. If you use sprites as extensively as I do, this involves opening every image and re-calculating the distance from the bottom up and inserting these numbers in an IE7 only style sheet.  Please, please tell me that I need to get another cup of coffee and I&#8217;m just dreaming this.   </p>
<h3>Update (05-02): Is this a position:absolute issue in IE7?</h3>
<p>I&#8217;m still seeing this bizarre activity in the sprites of absolutely positioned elements. The sprites of links and other objects that are not positioned are working fine. sigh&#8230;</p>
<h3>Update: IE7 passes sprite test (05-07)</h3>
<p>I&#8217;ve created a test page to see if I could narrow down the issues with IE7 and sprites. I was surprised to find <a href="http://www.last-child.com/ie7-passes-the-sprite-test/">IE7 passed my initial tests</a>. It must be a unique combination of styles causing my problem. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.last-child.com/ie7-measuring-sprites-from-bottom-up/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Image replacement and screenreaders</title>
		<link>http://www.last-child.com/image-replacement-and-screenreaders/</link>
		<comments>http://www.last-child.com/image-replacement-and-screenreaders/#comments</comments>
		<pubDate>Thu, 20 Apr 2006 02:04:32 +0000</pubDate>
		<dc:creator>Ted</dc:creator>
				<category><![CDATA[Accessibility]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Image Replacement]]></category>
		<category><![CDATA[Link]]></category>
		<category><![CDATA[Quick Tips]]></category>
		<category><![CDATA[background]]></category>
		<category><![CDATA[text-indent]]></category>

		<guid isPermaLink="false">http://www.last-child.com/image-replacement-and-screenreaders/</guid>
		<description><![CDATA[Ok kids, if you use image replacement to create super-cool rollover buttons, raise your hands.  Good. Now, keep your hands raised if you put title attributes on the links to give  added information.  Great!  What is the text inside the link? Keep your hands raised if you repeated your title attribute [...]]]></description>
			<content:encoded><![CDATA[<p>Ok kids, if you use <a href="http://phark.typepad.com/phark/2003/08/accessible_imag.html">image replacement</a> to create super-cool rollover buttons, raise your hands.  Good. Now, keep your hands raised if you put title attributes on the links to give  added information.  Great!  What is the text inside the link? Keep your hands raised if you repeated your title attribute in the link text.</p>
<p><strong>Congratulations</strong>, you&#8217;ve probably done some usability testing with an actual screen reader.  </p>
<p>For those who put your hands down; here&#8217;s the deal-eeo.  Screenreaders ignore title attributes by default. Sucks&#8230; I know.  I&#8217;ve been adding really juicy title attributes for usability and they&#8217;re being ignored!  </p>
<h3>Go ahead and duplicate your text</h3>
<p>I was doing some user-testing today with <a href="http://www.victortsaran.com/">Victor Tsaran</a>, the <a href="http://blog.360.yahoo.com/blog-cXwqpNonb7W4nud89xms">Accessibility Project Manager</a> at Yahoo! He came across a button with link text that was the same as the image. He said, &#8220;what&#8217;s this going to do?&#8221;  It was a simple thing like &#8220;more info&#8221;&#8230; But the title attribute said &#8220;Visit Joe&#8217;s Web Site for more information.&#8221;  That, he suggested, should have been the link text. </p>
<p>The link text is hidden from the visual users and the title attribute is hidden from the screen readers; so duplicating the information isn&#8217;t a bad thing. If you find yourself putting good information in a title attribute for a link that is using image replacement, duplicate the content in the link. It&#8217;s that simple.  Now, put your hands down, it&#8217;s starting to smell musky around here.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.last-child.com/image-replacement-and-screenreaders/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Control form button width in IE6</title>
		<link>http://www.last-child.com/control-form-button-width-in-ie6/</link>
		<comments>http://www.last-child.com/control-form-button-width-in-ie6/#comments</comments>
		<pubDate>Wed, 19 Apr 2006 00:03:59 +0000</pubDate>
		<dc:creator>Ted</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Form Button]]></category>
		<category><![CDATA[Quick Tips]]></category>
		<category><![CDATA[background]]></category>
		<category><![CDATA[border]]></category>
		<category><![CDATA[overflow]]></category>
		<category><![CDATA[padding]]></category>

		<guid isPermaLink="false">http://www.last-child.com/control-form-button-width-in-ie6/</guid>
		<description><![CDATA[I&#8217;m working on a project with shiny, happy submit buttons all over the place. To offer more control over the presentation, we are using the form button element and inserting images inside the button tags.


...





Now, you need to over-ride some pretty ugly default presentation styles:

form button {padding:0; margin:0; border:none; background:0;}

This works fine and dandy until [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m working on a project with shiny, happy submit buttons all over the place. To offer more control over the presentation, we are using the form button element and inserting images inside the button tags.<br />
<code lang="HTML"></p>
<form>
...<br />
<button type="submit" name="submit" id="submit"><br />
<img src="submit.png" alt="submit" /><br />
</button><br />
</form>
<p></code></p>
<p>Now, you need to over-ride some pretty ugly default presentation styles:</p>
<p><code lang="CSS"><br />
form button {padding:0; margin:0; border:none; background:0;}<br />
</code></p>
<p>This works fine and dandy until you get to IE6. The buttons tend to get really large with IE. So, you need to re-define the width of the buttons and apply overflow:visible. Here&#8217;s the entry in your IE6.css file:<br />
<code lang="CSS"><br />
form button {width:1%; overflow:visible;}<br />
</code></p>
<h3>Resources</h3>
<p>Special thanks to <a href="http://jehiah.com/archive/button-width-in-ie">Jehiah Czebotar</a> for saving me a bunch of time trying to figure this out.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.last-child.com/control-form-button-width-in-ie6/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Get rid of the dotted lines on links with image replacement</title>
		<link>http://www.last-child.com/get-rid-of-the-dotted-lines-on-links-with-image-replacement/</link>
		<comments>http://www.last-child.com/get-rid-of-the-dotted-lines-on-links-with-image-replacement/#comments</comments>
		<pubDate>Tue, 18 Apr 2006 17:15:40 +0000</pubDate>
		<dc:creator>Ted</dc:creator>
				<category><![CDATA[:focus]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Link]]></category>
		<category><![CDATA[Quick Tips]]></category>
		<category><![CDATA[background]]></category>
		<category><![CDATA[text-indent]]></category>

		<guid isPermaLink="false">http://www.last-child.com/get-rid-of-the-dotted-lines-on-links-with-image-replacement/</guid>
		<description><![CDATA[I don&#8217;t remember where I first found this tip (Hedger Wang?), but it&#8217;s a good one. If you are using image replacement, i.e. background images and negative text-indent, you may notice a dotted line appear when the link is clicked and waiting for the page to change (:focus). It&#8217;s outlining the text that happens to [...]]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t remember where I first found this tip (Hedger Wang?), but it&#8217;s a good one. If you are using image replacement, i.e. background images and negative text-indent, you may notice a dotted line appear when the link is clicked and waiting for the page to change (:focus). It&#8217;s outlining the text that happens to be wayyyyy off screen. It&#8217;s easy as pie to fix this issue.</p>
<h4>CSS Fix</h4>
<p>This will fix the problem in Firefox. Just drop this into your global.css file.<br />
<code lang="CSS"><br />
a:focus { -moz-outline-style: none; }/*this avoids having image replacement sections display a dotted outline*/<br />
</code></p>
<h4>JavaScript Fix</h4>
<p>This will fix the issue in the other browsers.<br />
<code lang="Javascript"><br />
var theahrefs = document.getElementsByTagName('a');<br />
//fix dotted line thing when link is OnClicked<br />
for(var x=0;x!=theahrefs.length;x++){<br />
theahrefs[x].onfocus = function stopLinkFocus(){this.hideFocus=true;};<br />
}<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.last-child.com/get-rid-of-the-dotted-lines-on-links-with-image-replacement/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Hacking to fix for IE7</title>
		<link>http://www.last-child.com/hacking-to-fix-for-ie7/</link>
		<comments>http://www.last-child.com/hacking-to-fix-for-ie7/#comments</comments>
		<pubDate>Mon, 27 Mar 2006 01:23:17 +0000</pubDate>
		<dc:creator>Ted</dc:creator>
				<category><![CDATA[:absolute]]></category>
		<category><![CDATA[:block]]></category>
		<category><![CDATA[:relative]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Conditional Comment]]></category>
		<category><![CDATA[Hacks]]></category>
		<category><![CDATA[IE7]]></category>
		<category><![CDATA[Image Sprites]]></category>
		<category><![CDATA[background]]></category>

		<guid isPermaLink="false">http://www.last-child.com/hacking-to-fix-for-ie7/</guid>
		<description><![CDATA[I&#8217;ve played around with IE7 for a while, but haven&#8217;t really started debugging with it until now.  Fortunately, I&#8217;ve already set up the site to use conditional comments and deliver an IE6.css file and a separate IE7.css file. This has made it much easier to target the offending areas of the site.
IE7 has had [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve played around with IE7 for a while, but haven&#8217;t really started debugging with it until now.  Fortunately, I&#8217;ve already set up the site to use conditional comments and deliver an IE6.css file and a separate IE7.css file. This has made it much easier to target the offending areas of the site.</p>
<p>IE7 has had a couple surprising problems for me.  I have a topnav section that completely disappeared. The container div only has <em>position:relative</em> and inside are a number of floated elements. This actuall works great in all browsers&#8230; but IE7! <strong>No hacks for IE6, but hack for IE7!</strong> I went with the old adage, I think from <a href="http://www.andybudd.com/index.php">Andy Budd</a>, when all else fails float, if it&#8217;s already floated, unfloat.  I added <em>float:left </em> to the container div and the topnav re-appeared from the IE7 void.</p>
<h3>Munged Background Images</h3>
<p>I&#8217;m using a series of positioning,  text-indent, and background images on the site.  Here&#8217;s a simplified version:</p>
<p><code lang="CSS"><br />
.targetdl dd {position:relative;}<br />
.targetdl dd span {text-indent:-1000em; width:66px; display:block;  position:absolute; top:5px; right:20px;}<br />
.happy0 span {background:url(/images/happy0.png) no-repeat 0 -650px;}<br />
</code></p>
<p>IE7 shows the background image ok on some pages and on other pages, it shrinks the background image. I tried adding zoom:1 and font-size:100% to no avail. I&#8217;ll try line-height next.  This is an odd bug, but not the first time I noticed it on IE7 betas.  It certainly seems to be buggy with positioning. </p>
<h3>De-bugging Strategy</h3>
<p>Since I&#8217;ve already got a fairly solid ie6.css file, I&#8217;m going to use that as the basis of my IE7 CSS construction.  After fixing the topnav, the rest of the ie6.css file is going into the IE7 css and rules will be removed one at a time. This should help me figure out what is still needed.</p>
<p>I&#8217;ll keep notes on this site as I find it a convenient place to remember them. Has anyone else come across some positioning bugs in IE7? Sorry, no screen shots or details at this time, we&#8217;re still pre-alpha stage.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.last-child.com/hacking-to-fix-for-ie7/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Attribute selectors to provide language information</title>
		<link>http://www.last-child.com/attribute-selectors-to-provide-language-information/</link>
		<comments>http://www.last-child.com/attribute-selectors-to-provide-language-information/#comments</comments>
		<pubDate>Sun, 26 Feb 2006 01:33:27 +0000</pubDate>
		<dc:creator>Ted</dc:creator>
				<category><![CDATA[:after]]></category>
		<category><![CDATA[Accessibility]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS2]]></category>
		<category><![CDATA[Image Sprites]]></category>
		<category><![CDATA[Link]]></category>
		<category><![CDATA[W3C]]></category>
		<category><![CDATA[attribute selector]]></category>
		<category><![CDATA[background]]></category>
		<category><![CDATA[padding]]></category>

		<guid isPermaLink="false">http://www.last-child.com/attribute-selectors-to-provide-language-information/</guid>
		<description><![CDATA[Attribute Selectors for International Web Sites
Sébastien Guillon, recently wrote a post about using the CSS2 attribute selector and content rule
to let visitors know what to expect when clicking on a link to an international web site. Inspired by his approach, I’ve simplified some of the code and added background images to
represent the countries.
Guillon’s original project [...]]]></description>
			<content:encoded><![CDATA[<h3>Attribute Selectors for International Web Sites</h3>
<p><a hreflang="fr-fr" href="http://sebastienguillon.com/journal/2005/10/exploiter-les-langues-avec-les-pseudo-classes-css">Sébastien Guillon</a>, recently wrote a post about using the CSS2 attribute selector and content rule<br />
to let visitors know what to expect when clicking on a link to an international web site. Inspired by his approach, I’ve simplified some of the code and added background images to<br />
represent the countries.</p>
<p>Guillon’s original project focused on adding a text description after the link in the site’s native language. To do this, he used a set of descending selectors to look at the page’s language declaration and the link’s hreflang attribute.  I am assuming the site that hosts this <acronym title="Cascading Style Sheets">CSS</acronym> is in english. However, it would not be difficult for you to simply change the generated content if your site is written in French, Spanish,<br />
Swahili, etc.</p>
<h3>Sample list of international Yahoo sites</h3>
<h4>Europe</h4>
<ul>
<li><a hreflang="ca" href="http://ct.yahoo.com/">Catalan</a></li>
<li><a hreflang="da-dk" href="http://dk.yahoo.com/">Denmark</a></li>
<li><a hreflang="fr-fr" href="http://fr.yahoo.com/">France</a></li>
<li><a hreflang="de-de" href="http://de.yahoo.com/">Germany</a></li>
<li><a hreflang="el-gr" href="http://gr.yahoo.com/">Greece</a></li>
<li><a hreflang="it-it" href="ithttp://it.yahoo.com/">Italy</a></li>
<li><a hreflang="no-no" href="http://no.yahoo.com/">Norway</a></li>
<li><a hreflang="sp-sp" href="http://es.yahoo.com/">Spain</a></li>
<li><a hreflang="sv-se" href="http://se.yahoo.com/">Sweden</a></li>
<li><a hreflang="en-gb" href="http://uk.yahoo.com/">UK </a></li>
<li><a hreflang="en-ie" href="http://uk.yahoo.com/"> Ireland</a></li>
</ul>
<p>Now look at the <a href="/international.html">final version with new <acronym title="Cascading Style Sheets">CSS</acronym></a>. Internet Explorer users will not see a difference, try <a href="http://www.mozilla.org">Firefox</a> or <a href="http://www.opera.com">Opera</a>. <ins>Internet Explorer 7 beta 2 shows the flags but does not show the generated content.</ins></p>
<h3>The hreflang Attribute</h3>
<p>The hreflang allows the user/browser to define the language of a link’s targeted page to avoid presenting<br />
unreadable information:</p>
<blockquote cite="http://www.w3.org/TR/html401/struct/links.html#adef-hreflang"><p>The hreflang attribute provides user agents with information about the language of a resource at the end of a link, just as the lang attribute provides information about the language of an element’s content or attribute values.</p>
<p><cite><acronym title="World Wide Web Consortium">W3C</acronym>.org</cite></p></blockquote>
<p>The hreflang attribute defines the language of the web site you are sending someone to. The language is defined with a two letter abbreviation, such as en, fr, sp… You can also define the locality of this language by adding the country code to this language.  This is particularly helpful for languages that have dialects. A Mexican site would have this attribute: hreflang=”sp-mx”.</p>
<h3>The Attribute Selector</h3>
<p>CSS2 allows us to look for tags that contain specific attributes.  We can look for blockquotes with cite attributes, tables with summaries, table cells with header attributes,<br />
and our little friend, the link with an hreflang attribute.</p>
<p><code lang="CSS"><br />
/*English */<br />
a[hreflang="en"]:after, a[hreflang|="en"]:after {content:"\A0(In English)";}<br />
</code></p>
<h3>Breaking it down</h3>
<p>This rule uses a combination of attribute selector and pseudo-class to transform the link from common to fabulous.</p>
<dl>
<dt> a[…]</dt>
<dd>Look for a link with an attribute</dd>
<dt>hreflang=”en”</dt>
<dd>The hreflang attribute must include the letters “en”. This allows the <acronym title="Cascading Style Sheets">CSS</acronym> to work on links that do not define a country variation</dd>
<dt>:after</dt>
<dd>This pseudoselector defines the space after the link</dd>
<dt>{content:”\A0(In English)”;}</dt>
<dd>After the link, place the following text: (In English)</dd>
<dt>hreflang|=”en”</dt>
<dd>The hreflang attribute must include the letters “en” within a hyphenated set, i.e. en-us, en-ca, …</dd>
</dl>
<h3>Adding the flag</h3>
<p>Now that we’ve notified the user about what language the link will be in, let’s tell them the country the site is from. Once again, we will look at the hreflang attribute for this information. This rule is not as neat and tidy. For each country, we are going to look for all of the possible language attributes. For instance, Canadian links could have hreflang=”fr-ca” and hreflang=”en-ca”.</p>
<p><code lang="CSS"><br />
/*Canada */<br />
a[hreflang="en-ca"], a[hreflang="fr-ca"] {background:<acronym title="Uniform Resource Locator">URL</acronym>(flag-sprite.png) no-repeat 0 0; padding-left:35px;}<br />
</code></p>
<p>This time, we will give links that have Canadian country codes 35px padding to the left side and a background image of the Canadian flag that sits to the<br />
left edge of the link’s text.  This style sheet is using an image sprite to keep the server requests to a minimum.  See the Alistapart.com article about using<br />
<a href="http://www.alistapart.com/articles/sprites">image sprites</a> for more information on this technique.</p>
<h3 lang="fr">Et Voilà</h3>
<p>There we have it. A set of international links with the country of origin and language clearly defined.  All of this has been made possible by our friends, the<br />
attribute selector, the pseudo-class, and the content style. Tune in next week as we learn how to make a cruise ship out of two<br />
shoe-boxes and an <acronym title="eXtensible Markup Language">XML</acronym> schema.</p>
<h3>Fine Print</h3>
<p>This has not been tested in Safari, but it shouldn’t be a problem. The pretty and useful presentation elements will not appear in <acronym title="Internet Explorer">IE</acronym>6, NN4, and probably<br />
most alternative devices (My Treo shows the flags but not the added content). I do not know how assistive devices would render these styles, more than likely they would be ignored. This project falls under<br />
the “build for the best, don’t hurt the rest™” protocol.</p>
<h3>Resources</h3>
<ul>
<li><a href="http://www.w3.org/TR/REC-CSS2/selector.html"><acronym title="World Wide Web Consortium">W3C</acronym> Selectors</a></li>
<li><a hreflang="fr-fr" href="http://sebastienguillon.com/journal/2005/10/exploiter-les-langues-avec-les-pseudo-classes-css">Exploiter les langues avec les pseudo-classes <acronym title="Cascading Style Sheets">CSS</acronym></a></li>
<li><a href="http://www.stuffandnonsense.co.uk/archives/css_a_tribute_to_selectors.html">A tribute to selectors</a> &#8211; Andy Clarke</li>
<li><a href="http://www.meyerweb.com/eric/articles/webrev/200008b.html">Attribute Selectors Part II</a> &#8211; Eric Meyers</li>
<li><a href="http://rollyo.com/search.html?q=hreflang&#038;sid=4886&#038;start=16">hreflang resources</a> &#8211; Standardistas</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.last-child.com/attribute-selectors-to-provide-language-information/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 1.725 seconds -->
