<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: CSS: Using Percentages in Background-Image</title>
	<atom:link href="http://www.sitepoint.com/blogs/2007/07/05/css-using-percentages-in-background-image/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sitepoint.com/blogs/2007/07/05/css-using-percentages-in-background-image/</link>
	<description>News, opinion, and fresh thinking for web developers and designers. The official podcast of sitepoint.com.</description>
	<lastBuildDate>Sat, 07 Nov 2009 23:35:20 -0500</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: kirankumar</title>
		<link>http://www.sitepoint.com/blogs/2007/07/05/css-using-percentages-in-background-image/comment-page-1/#comment-919398</link>
		<dc:creator>kirankumar</dc:creator>
		<pubDate>Sat, 18 Apr 2009 04:38:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=1961#comment-919398</guid>
		<description>Thank you</description>
		<content:encoded><![CDATA[<p>Thank you</p>]]></content:encoded>
	</item>
	<item>
		<title>By: busy</title>
		<link>http://www.sitepoint.com/blogs/2007/07/05/css-using-percentages-in-background-image/comment-page-1/#comment-777854</link>
		<dc:creator>busy</dc:creator>
		<pubDate>Sun, 10 Aug 2008 19:57:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=1961#comment-777854</guid>
		<description>@Scott - Nicely done background! Little things like that can add a lot in terms of having a site that&#039;s fresh, but you can&#039;t quite put your finger on why (unless you&#039;re a designer of course)

@Alex - Excellent blog post. I had always just thought percentages were secretly laughing at me, now I see they actually make some sense. Bill Rehm beat me to the punch, mentioning how adding frames will solve the IE rounding problem. 

Personally I wouldn&#039;t even worry about using blank frames to achieve this if you&#039;re doing an animation, why not just use the right amount of frames from the beginning when you&#039;re thinking it out? There may be cases where you absolutely need to have 4 and only 4, but is an extra useful frame going to cause problems in 90% of the situations?

And if you&#039;re just doing a hover image or something, then it won&#039;t be so heavily scripted so a blank frame won&#039;t add any extra complexity anyways.</description>
		<content:encoded><![CDATA[<p>@Scott &#8211; Nicely done background! Little things like that can add a lot in terms of having a site that&#8217;s fresh, but you can&#8217;t quite put your finger on why (unless you&#8217;re a designer of course)</p>
<p>@Alex &#8211; Excellent blog post. I had always just thought percentages were secretly laughing at me, now I see they actually make some sense. Bill Rehm beat me to the punch, mentioning how adding frames will solve the IE rounding problem. </p>
<p>Personally I wouldn&#8217;t even worry about using blank frames to achieve this if you&#8217;re doing an animation, why not just use the right amount of frames from the beginning when you&#8217;re thinking it out? There may be cases where you absolutely need to have 4 and only 4, but is an extra useful frame going to cause problems in 90% of the situations?</p>
<p>And if you&#8217;re just doing a hover image or something, then it won&#8217;t be so heavily scripted so a blank frame won&#8217;t add any extra complexity anyways.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Scott Showalter</title>
		<link>http://www.sitepoint.com/blogs/2007/07/05/css-using-percentages-in-background-image/comment-page-1/#comment-776943</link>
		<dc:creator>Scott Showalter</dc:creator>
		<pubDate>Sat, 09 Aug 2008 06:21:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=1961#comment-776943</guid>
		<description>I recently used negative percentages in my design for a &lt;a href=&quot;http://www.marineworld247.com&quot; title=&quot;Marine Electronics&quot; rel=&quot;nofollow&quot;&gt;Marine Electronics&lt;/a&gt; site. The site features an extensively designed underwater sea-life scene in the background which, when resized, moves the elements of the composition around in an interesting fasion. It&#039;s a hidden gem, but a fun one for those curious to see how the design looks at a different page width.

I was desperately trying to figure out the term for this sort of effect, but only thought of it after the fact. It&#039;s called the &quot;parallax effect&quot; and I originally saw it on the &lt;a href=&quot;http://www.silverbackapp.com/&quot; rel=&quot;nofollow&quot;&gt;Silverback site&lt;/a&gt;. But oddly, I only stumbled across that site again after the fact. Still cool to look at in hindsight though.</description>
		<content:encoded><![CDATA[<p>I recently used negative percentages in my design for a <a href="http://www.marineworld247.com" title="Marine Electronics" rel="nofollow">Marine Electronics</a> site. The site features an extensively designed underwater sea-life scene in the background which, when resized, moves the elements of the composition around in an interesting fasion. It&#8217;s a hidden gem, but a fun one for those curious to see how the design looks at a different page width.</p>
<p>I was desperately trying to figure out the term for this sort of effect, but only thought of it after the fact. It&#8217;s called the &#8220;parallax effect&#8221; and I originally saw it on the <a href="http://www.silverbackapp.com/" rel="nofollow">Silverback site</a>. But oddly, I only stumbled across that site again after the fact. Still cool to look at in hindsight though.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Stevie D</title>
		<link>http://www.sitepoint.com/blogs/2007/07/05/css-using-percentages-in-background-image/comment-page-1/#comment-775992</link>
		<dc:creator>Stevie D</dc:creator>
		<pubDate>Thu, 07 Aug 2008 12:15:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=1961#comment-775992</guid>
		<description>&lt;blockquote&gt;I think that would be ok if it caused a general flicker or jitter in the animation, but the problem is the one pixel mis-alignment that is generated on the first loop becomes 2, 3 and 4 on each new loop. The result is the whole animation begins to slide off the top of the frame and back onto the bottom.&lt;/blockquote&gt;

I don&#039;t think it is a problem, as long as you make sure of the following points:
- round decimals properly ... so 33.33 -&gt; 33% and 66.66 -&gt; 67%
- draw a 1px white/transparent border around the outside edge of each frame, so you will get a &lt;strong&gt;2px&lt;/strong&gt; white line between frames.

That seems to be solving the problem for me, but if you&#039;ve got a concrete example where it isn&#039;t working, post it and I&#039;ll see if I can fix it!</description>
		<content:encoded><![CDATA[<blockquote><p>I think that would be ok if it caused a general flicker or jitter in the animation, but the problem is the one pixel mis-alignment that is generated on the first loop becomes 2, 3 and 4 on each new loop. The result is the whole animation begins to slide off the top of the frame and back onto the bottom.</p></blockquote>
<p>I don&#8217;t think it is a problem, as long as you make sure of the following points:<br />
- round decimals properly &#8230; so 33.33 -&gt; 33% and 66.66 -&gt; 67%<br />
- draw a 1px white/transparent border around the outside edge of each frame, so you will get a <strong>2px</strong> white line between frames.</p>
<p>That seems to be solving the problem for me, but if you&#8217;ve got a concrete example where it isn&#8217;t working, post it and I&#8217;ll see if I can fix it!</p>]]></content:encoded>
	</item>
	<item>
		<title>By: AlexW</title>
		<link>http://www.sitepoint.com/blogs/2007/07/05/css-using-percentages-in-background-image/comment-page-1/#comment-775581</link>
		<dc:creator>AlexW</dc:creator>
		<pubDate>Wed, 06 Aug 2008 21:50:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=1961#comment-775581</guid>
		<description>&lt;blockquote&gt;If you’ve got a containing block that’s 500px wide and an image that’s 300px wide, that leaves 200px of white space. That is what you are divvying up.&lt;/blockquote&gt;

That&#039;s a clever way to think about it, Stevie. I like that.

&lt;blockquote&gt;The answer to the IE rounding problem? I would guess that putting white/transparent space between each of the coloured blocks would solve the problem - the block might be a pixel out when using IE compared with Ffx/Opera, but you wouldn’t get that unsightly line in the wrong colour.&lt;/blockquote&gt;

I think that would be ok if it caused a general flicker or jitter in the animation, but the problem is the one pixel mis-alignment that is generated on the first loop becomes 2, 3 and 4 on each new loop. The result is the whole animation begins to slide off the top of the frame and back onto the bottom. 

Unless you coded it to recalibrate on each pass (and you could) I can&#039;t see it being viable.</description>
		<content:encoded><![CDATA[<blockquote><p>If you’ve got a containing block that’s 500px wide and an image that’s 300px wide, that leaves 200px of white space. That is what you are divvying up.</p></blockquote>
<p>That&#8217;s a clever way to think about it, Stevie. I like that.</p>
<blockquote><p>The answer to the IE rounding problem? I would guess that putting white/transparent space between each of the coloured blocks would solve the problem &#8211; the block might be a pixel out when using IE compared with Ffx/Opera, but you wouldn’t get that unsightly line in the wrong colour.</p></blockquote>
<p>I think that would be ok if it caused a general flicker or jitter in the animation, but the problem is the one pixel mis-alignment that is generated on the first loop becomes 2, 3 and 4 on each new loop. The result is the whole animation begins to slide off the top of the frame and back onto the bottom. </p>
<p>Unless you coded it to recalibrate on each pass (and you could) I can&#8217;t see it being viable.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Stevie D</title>
		<link>http://www.sitepoint.com/blogs/2007/07/05/css-using-percentages-in-background-image/comment-page-1/#comment-775306</link>
		<dc:creator>Stevie D</dc:creator>
		<pubDate>Wed, 06 Aug 2008 12:06:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=1961#comment-775306</guid>
		<description>The way to think about percentage positioning is this.

If you&#039;ve got a containing block that&#039;s 500px wide and an image that&#039;s 300px wide, that leaves 200px of white space. &lt;em&gt;That&lt;/em&gt; is what you are divvying up.

If you set a value of 10%, that means 10% of the white space (=20px) will be to the left of the image (and 90% will be to the right), so the image is 20px in from the left. It&#039;s a different calculation, but it gives you the same answer.

If you are looking at multiple sprites, think of the hidden overflow instead of the white space.

The answer to the IE rounding problem? I would guess that putting white/transparent space between each of the coloured blocks would solve the problem - the block might be a pixel out when using IE compared with Ffx/Opera, but you wouldn&#039;t get that unsightly line in the wrong colour.</description>
		<content:encoded><![CDATA[<p>The way to think about percentage positioning is this.</p>
<p>If you&#8217;ve got a containing block that&#8217;s 500px wide and an image that&#8217;s 300px wide, that leaves 200px of white space. <em>That</em> is what you are divvying up.</p>
<p>If you set a value of 10%, that means 10% of the white space (=20px) will be to the left of the image (and 90% will be to the right), so the image is 20px in from the left. It&#8217;s a different calculation, but it gives you the same answer.</p>
<p>If you are looking at multiple sprites, think of the hidden overflow instead of the white space.</p>
<p>The answer to the IE rounding problem? I would guess that putting white/transparent space between each of the coloured blocks would solve the problem &#8211; the block might be a pixel out when using IE compared with Ffx/Opera, but you wouldn&#8217;t get that unsightly line in the wrong colour.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: AlexW</title>
		<link>http://www.sitepoint.com/blogs/2007/07/05/css-using-percentages-in-background-image/comment-page-1/#comment-774960</link>
		<dc:creator>AlexW</dc:creator>
		<pubDate>Tue, 05 Aug 2008 21:32:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=1961#comment-774960</guid>
		<description>I remember a similar &#039;penny drop&#039; moment myself, Mike. Glad you could get some good value out of the post.</description>
		<content:encoded><![CDATA[<p>I remember a similar &#8216;penny drop&#8217; moment myself, Mike. Glad you could get some good value out of the post.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: mikeycampling</title>
		<link>http://www.sitepoint.com/blogs/2007/07/05/css-using-percentages-in-background-image/comment-page-1/#comment-774901</link>
		<dc:creator>mikeycampling</dc:creator>
		<pubDate>Tue, 05 Aug 2008 19:35:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=1961#comment-774901</guid>
		<description>Thank you for that clear explanation.  The diagram gave me an instant penny-drop moment.  I liked it so much I went out and joined the community.
Thanks again.
MC</description>
		<content:encoded><![CDATA[<p>Thank you for that clear explanation.  The diagram gave me an instant penny-drop moment.  I liked it so much I went out and joined the community.<br />
Thanks again.<br />
MC</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://www.sitepoint.com/blogs/2007/07/05/css-using-percentages-in-background-image/comment-page-1/#comment-317962</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Sat, 28 Jul 2007 13:01:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=1961#comment-317962</guid>
		<description>&lt;blockquote&gt;
There are three viable methods available to control background-position, and you are not allowed mix and match them (i.e. background-position: top 50%;).&lt;/blockquote&gt;

That was only true in css2 but css2.1 allows for keywords to be mixed and matched with percentages or pixels etc. It is prefectly valid to do this but some older browsers are still confused by it so its still best not to  mix keywords into the mix. There really is no point anyway as the keywords equate exactly into eqivalent percentage sizes anyway.</description>
		<content:encoded><![CDATA[<blockquote><p>
There are three viable methods available to control background-position, and you are not allowed mix and match them (i.e. background-position: top 50%;).</p></blockquote>
<p>That was only true in css2 but css2.1 allows for keywords to be mixed and matched with percentages or pixels etc. It is prefectly valid to do this but some older browsers are still confused by it so its still best not to  mix keywords into the mix. There really is no point anyway as the keywords equate exactly into eqivalent percentage sizes anyway.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: serializer</title>
		<link>http://www.sitepoint.com/blogs/2007/07/05/css-using-percentages-in-background-image/comment-page-1/#comment-316965</link>
		<dc:creator>serializer</dc:creator>
		<pubDate>Fri, 27 Jul 2007 15:27:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=1961#comment-316965</guid>
		<description>I&#039;ve had reasonable success using &lt;strong&gt;multiples&lt;/strong&gt; of -100%. This shifts the background by multiples of the width or height of the containing element. I&#039;ve set up a &lt;a href=&quot;http://www.pixelpunch.co.uk/resources/css-borders.html&quot; rel=&quot;nofollow&quot;&gt;basic example&lt;/a&gt; demonstrating a resizable graphical border using only 2 sprite images (one horizontal, one vertical) and very clean HTML+CSS. The bottom-right corner is a resize handle (using jQuery). I&#039;m working this into a set of tutorials so it&#039;s half-finished.

There was a weird problem with the right and bottom borders; for some reason the effect of the background-position wrapped round at -100% so the background disappeared completely (unless repeat was specified for &lt;strong&gt;both&lt;/strong&gt; axes but there are other reasons I didn&#039;t want this!). I think it&#039;s to do with the left:100% and top:100% positioning of those elements, in combination with the quirks of background positioning as described here. I worked around it by offsetting +100% instead which shifted onto the LAST sprite.

I&#039;ve tested on IE6+7, FF, Opera9, Safari3, all fine.</description>
		<content:encoded><![CDATA[<p>I&#8217;ve had reasonable success using <strong>multiples</strong> of -100%. This shifts the background by multiples of the width or height of the containing element. I&#8217;ve set up a <a href="http://www.pixelpunch.co.uk/resources/css-borders.html" rel="nofollow">basic example</a> demonstrating a resizable graphical border using only 2 sprite images (one horizontal, one vertical) and very clean HTML+CSS. The bottom-right corner is a resize handle (using jQuery). I&#8217;m working this into a set of tutorials so it&#8217;s half-finished.</p>
<p>There was a weird problem with the right and bottom borders; for some reason the effect of the background-position wrapped round at -100% so the background disappeared completely (unless repeat was specified for <strong>both</strong> axes but there are other reasons I didn&#8217;t want this!). I think it&#8217;s to do with the left:100% and top:100% positioning of those elements, in combination with the quirks of background positioning as described here. I worked around it by offsetting +100% instead which shifted onto the LAST sprite.</p>
<p>I&#8217;ve tested on IE6+7, FF, Opera9, Safari3, all fine.</p>]]></content:encoded>
	</item>
</channel>
</rss>
