<?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>Likesalmon.net &#187; CSS</title>
	<atom:link href="http://likesalmon.net/tag/css/feed/" rel="self" type="application/rss+xml" />
	<link>http://likesalmon.net</link>
	<description>Web development for designers</description>
	<lastBuildDate>Sat, 21 Jan 2012 20:40:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Tile images in Imagemagick to create CSS sprites</title>
		<link>http://likesalmon.net/tile-images-in-imagemagick-to-create-css-sprites/</link>
		<comments>http://likesalmon.net/tile-images-in-imagemagick-to-create-css-sprites/#comments</comments>
		<pubDate>Fri, 04 Jun 2010 05:31:35 +0000</pubDate>
		<dc:creator>Ammon</dc:creator>
				<category><![CDATA[Musings]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Imagemagick]]></category>

		<guid isPermaLink="false">http://likesalmon.net/?p=350</guid>
		<description><![CDATA[The Magick This will stack two images to create a CSS sprite. Very handy for flicker-free image rollovers: $ montage -background transparent -tile 1x2 -geometry +0+2 image1.gif image2.gif result.gif You could create a taller or wider stack by adjusting the -tile option. For example -tile 2x10 would stack 2 images across and 10 images down. [...]]]></description>
			<content:encoded><![CDATA[<h3>The Magick</h3>
<p>This will stack two images to create a CSS sprite.  Very handy for flicker-free image rollovers:</p>
<p><code>$ montage -background transparent -tile 1x2 -geometry +0+2 <em>image1.gif</em> <em>image2.gif</em> result.gif</code></p>
<p>You could create a taller or wider stack by adjusting the <code>-tile</code> option.  For example <code>-tile 2x10</code> would stack 2 images across and 10 images down.  If you don&#8217;t have 20 images, Imagemagick will leave empty spaces.</p>
<p>Not sure why I had to set <code>-geometry +0+2</code>.  That creates a 2 pixel vertical offset, which was necessary to align to two images.  If you leave it at <code>-geometry +0+0</code> the hover image is slightly off, which makes for a cool &#8220;pressed in&#8221; effect, but it&#8217;s not always what I need.</p>
<h3>The CSS</h3>
<p>The CSS you would use to make the rollover work would go something like this:</p>
<p><code><br />
a.rollover {<br />
background: url('Images/result.gif') no-repeat center top;<br />
display: block; /* necessary to set the width and height of a tags */<br />
text-indent: -99999px; /* get the link text out of the way if replaced by an image */<br />
overflow: hidden; /* so you don't get the dotted outline when you click on the link */<br />
width: 100px;<br />
height: 100px;<br />
}</p>
<p>a.rollover:hover {<br />
background: url('Images/result.gif') no-repeat center bottom;<br />
}<br />
</code></p>
<h3>Bash bonus!</h3>
<p>When I did this, I had a folder of images with the naming scheme <em>menu_img1.gif, menu_img1_on.gif, menu_img2.gif, menu_img2_on.gif.. .etc.</em>.  I automated the sprite creation process from the command line like this:</p>
<p><code><br />
$ array=( img1 img2 img3 )<br />
$ for i in 0 1 2<br />
$ do<br />
$ montage -background transparent -tile 1x2 -geometry +0+2 menu_${array[i]}.gif menu_${array[i]}_on.gif menu_${array[i]}_sprite.gif<br />
$ done</code></p>
]]></content:encoded>
			<wfw:commentRss>http://likesalmon.net/tile-images-in-imagemagick-to-create-css-sprites/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>FTOB: CSS width property does exactly what you would expect it to</title>
		<link>http://likesalmon.net/ftob-css-width-property-does-exactly-what-you-would-expect-it-to/</link>
		<comments>http://likesalmon.net/ftob-css-width-property-does-exactly-what-you-would-expect-it-to/#comments</comments>
		<pubDate>Sat, 25 Apr 2009 22:13:32 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[From the old blog]]></category>
		<category><![CDATA[Tests]]></category>

		<guid isPermaLink="false">http://likesalmon.net/?p=59</guid>
		<description><![CDATA[Originally posted on 10/19/08 at http://likesalmon.wordpress.com The other day I was laying out a wordpress driven site in css and realized that I didn&#8217;t actually understand how the &#8220;width&#8221; property works. This was extremely embarrassing to admit to myself, because it means I&#8217;ve been flubbing and cheating my way through the layout of every website [...]]]></description>
			<content:encoded><![CDATA[<p>Originally posted on 10/19/08 at http://likesalmon.wordpress.com</p>
<p>The other day I was laying out a wordpress driven site in css and realized that I didn&#8217;t actually understand how the &#8220;width&#8221; property works.  This was extremely embarrassing to admit to myself, because it means I&#8217;ve been flubbing and cheating my way through the layout of every website I&#8217;ve developed so far.  Its one the things that fell through the cracks because of limited time or lack of will.  So I did a little testing and it turns out the width property works in the most obvious way possible, with one exception.  Here are the results of my test:</p>
<p>All of the following boxes are div elements set to <code>width: 200px; height: 200px</code> and <code>background-color: #ccc</code>.  I use lots of <a title="Examples of the CSS padding shorthand property on the W3 schools website" href="http://www.w3schools.com/css/pr_padding.asp">shorthand</a>, so you&#8217;ll want to review that or this won&#8217;t make much sense.  I performed this test in Firefox 3 so I trust that this behavior is the standard.</p>
<p><em>The following code was removed because it was breaking my layout &#8212; ed.</em></p>
<div class="box" style="margin: 20px 0pt; background-color: #cccccc; width: 200px; height: 200px;">This is the basic box.  No other styling has been added.  If you add more text to the box than the box can hold, it will flow outside the box, but the box will remain the same size.  To cut the text off at the edges of the box use &#8220;overflow: hidden&#8221;.</div>
<div id="one" class="box" style="border: 10px solid black; margin: 20px 0pt; background-color: #cccccc; width: 200px; height: 200px;">The <em>border</em> property of this box is set to <code>border: 10x;</code>. Notice how the inner box is still 200px by 200px.  The border has been added to the outside.  The total dimensions of the div are now 220px by 220px.</div>
<div class="box" style="margin: 40px; background-color: #cccccc; width: 200px; height: 200px;">The <em>margin</em> of this box is set to <code>margin: 40px</code>. The space it now takes up is 280px by 280px. Margins appear to behave exactly like borders, except they are always transparent.</div>
<div class="box" style="margin: 20px 0pt; padding: 10px; background-color: #cccccc; width: 200px; height: 200px;margin-bottom:50px">The <em>padding</em> of this box is set to <code>padding: 10px;</code>.  Notice how this expanded the box 10px on each side, for a total height and width change of 20px. This is the one unexpected behavior I encountered: I figured it would constrain the contents of the box instead of expanding the box itself.</div>
<div style="padding: 10px; background-color: #cccccc; width: 200px; height: 200px;margin-bottom:70px">This box is like the last one, with <code>padding: 10px;</code>.  The difference is that this one is <em>nested inside a div</em> with <code>width: 200px; height: 200px;</code>.  Unless the <code>overflow: hidden;</code> property is set, this makes no difference at all.  The box still expands to 220px by 220px and overflows the container div.</div>
<div id="six" class="box" style="background-color: #cccccc; width: 200px; height: 200px;">This box is <em>contained within a div</em> that is 100px smaller than it is.  This only makes a difference if you use &#8220;overflow: hidden&#8221;, which will cut off the edges of the box where the container div ends.  Keep in mind that the next element on the page will butt up against the parent div and will be overlapped by the over-sized box contained therein.  I had to adjust the margin of the <code>&lt;p&gt;</code> element that follows this div so they don&#8217;t overlap.</div>
<p style="margin-top:200px">In conclusion, if you&#8217;re designing a site that is 800px wide with an 8px border, you would subtract the width of the border from the width of the container element like so: <code>#container { width: 792px; border: 8px solid #ccc; }</code>.  The #container element stays at 800px and everyone is happy.</p>
]]></content:encoded>
			<wfw:commentRss>http://likesalmon.net/ftob-css-width-property-does-exactly-what-you-would-expect-it-to/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

