<?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>Blog &#124; WirthDesign &#187; tutorial</title>
	<atom:link href="http://wirthdesign.com/blog/tag/tutorial/feed" rel="self" type="application/rss+xml" />
	<link>http://wirthdesign.com/blog</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Wed, 23 Jun 2010 02:51:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Tutorial: Create a Simple CSS Image Rollover</title>
		<link>http://wirthdesign.com/blog/tutorial-create-a-simple-css-image-rollover.html</link>
		<comments>http://wirthdesign.com/blog/tutorial-create-a-simple-css-image-rollover.html#comments</comments>
		<pubDate>Sat, 12 Sep 2009 04:50:01 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[button]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[photoshop]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://wirthdesign.com/blog/?p=25</guid>
		<description><![CDATA[Create a simple image rollover using just CSS and a single image. It doesn't get much easier than this.]]></description>
			<content:encoded><![CDATA[<p>What you need for this tutorial</p>
<ul>
<li>Image Editing Software (ie: Adobe Photoshop)</li>
<li>An average understanding your editing software</li>
<li>Notepad or other code editing software</li>
</ul>
<p>I believe this is the best way to create any type of image rollover. Other ways are to use JavaScript but I find this unnecessary because the CSS way is very straight forward and easy to do. A example of this would be my &#8220;Portfolio&#8221; button I have on the front of my website. <span id="more-25"></span> You&#8217;ll see when you roll your mouse over the button (On the main page) changes from a shade of green to a shade of blue.</p>
<p><img class="size-full wp-image-26 alignleft" title="blog_003_site-front" src="http://wirthdesign.com/blog/wp-content/uploads/2009/09/blog_003_site-front.jpg" alt="blog_003_site-front" width="600" height="375" /></p>
<div style="clear:both; margin-bottom:100px;"></div>
<p>Now let&#8217;s open your image editing software. I prefer to use Adobe Photoshop because it is the most common editing software available. For this tutorial I am going to be using a button I made when I designed this website.</p>
<p><img src="http://wirthdesign.com/blog/wp-content/uploads/2009/09/bglo_003-button-1.jpg" alt="bglo_003-button-1" title="bglo_003-button-1" width="222" height="57" class="alignleft size-full wp-image-28" /></p>
<div style="clear:both; margin-bottom:100px;"></div>
<p>This image is 222 pixels wide and 57 pixels in height. With the image opened in you edit software we&#8217;re going to change the &#8220;Canvas Size&#8221;. You can find &#8220;Canvas Size&#8221; in Photoshop under &#8220;Image&#8221; in the overhead menu.</p>
<p><img src="http://wirthdesign.com/blog/wp-content/uploads/2009/09/blog_003-canvas-size.jpg" alt="blog_003-canvas-size" title="blog_003-canvas-size" width="600" height="450" class="alignleft size-full wp-image-29" /></p>
<div style="clear:both; margin-bottom:100px;"></div>
<p>Now the way I&#8217;ve learned to do a proper CSS Image Rollover is to use 1 image for both actions (normal position and hover position). This makes the loading of the images smoother and requires 1 less image. Let&#8217;s double the height of the &#8220;Canvas&#8221; and make it 114 pixels (Original height of 57 pixels X2). Note: Make sure you select the top center box for &#8220;Anchor:&#8221; so that we are adding the extra 57 pixels of canvas BELOW our existing image.</p>
<p><img src="http://wirthdesign.com/blog/wp-content/uploads/2009/09/blog_003-extra-canvas.jpg" alt="blog_003-extra-canvas" title="blog_003-extra-canvas" width="600" height="375" class="alignleft size-full wp-image-30" /></p>
<div style="clear:both; margin-bottom:100px;"></div>
<p>Make sure this image above looks like what your looking at. Next under &#8220;File&#8221; in the above menu you want to select &#8220;Place&#8221; and select the same image you&#8217;ve started with but place it underneath using snaps to ensure that it is exactly under neath.</p>
<p><img src="http://wirthdesign.com/blog/wp-content/uploads/2009/09/blog_003-double-image.jpg" alt="blog_003-double-image" title="blog_003-double-image" width="600" height="375" class="alignleft size-full wp-image-31" /></p>
<div style="clear:both; margin-bottom:100px;"></div>
<p>From this point we need to alter the bottom image so that it differs from the image above. I&#8217;ve chosen to just make my button green using my original files. You can use some form of &#8220;Blending Options&#8221; to achieve a different look.</p>
<p><img src="http://wirthdesign.com/blog/wp-content/uploads/2009/09/blog_003-final-button.jpg" alt="blog_003-final-button" title="blog_003-final-button" width="222" height="114" class="alignleft size-full wp-image-32" /></p>
<div style="clear:both; margin-bottom:100px;"></div>
<p>Save your file and put away your image editing software. Now open the page you want to add your button to in your favorite code writing software (ie: Notepad, Coda, Dreamweaver etc). Now lets go to your style sheet or inline styling section and add the few lines of code we need to make this work.</p>
<p>Ok, I&#8217;m calling this &#8220;.button_folio&#8221;, name it whatever you want just remember it so when you write your code you don&#8217;t confuse yourself. The height and width are what we want to be visible and since we are telling this to display as a block we wont see anything below 57px of the height. With the background we will be linking to our single image that we created earlier. Note that in background we have &#8220;0 -57&#8243; this very important because we&#8217;re telling the browser to start this background 57 pixels below what it normally would.</p>
<p><code>.button_folio {<br />
     width:222px;<br />
     height:57px;<br />
     display:block;<br />
     background:url(images/button_folio.gif) 0 -57px no-repeat;<br />
}</code></p>
<div style="clear:both; margin-bottom:100px;"></div>
<p>This is the final CSS that will tell the browser to move the background position to &#8220;0 0&#8243; (which is 57 pixels higher) when you &#8220;hover&#8221; your mouse over it.</p>
<p><code>.button_folio:hover {<br />
     background-position:0 0;<br />
}</code></p>
<div style="clear:both; margin-bottom:100px;"></div>
<p>Now to use this new &#8220;Class&#8221; on your page. Since this is a button and we&#8217;re using it to link to a page it only make sense to use this class on a link. Just add the code below to a link before &#8220;href&#8221; or after the URL.</p>
<p><code>class="button_folio"</code></p>
<div style="clear:both; margin-bottom:100px;"></div>
<p>Pow there you go! We made two new classes in a style sheet and called it out on the page. I believe this to be the best way to do this. I&#8217;m sure if you are a &#8220;text replacement nut&#8221; you can add text within the link instead of leaving nothing in between the tag and use a span to indent the text off the screen but I don&#8217;t really understand catering to people who don&#8217;t use style sheets.</p>
<p><a href="#" style="{width:222px: height:57px; display:block; background:url(/images/button_folio.gif) 0 -57px no-repeat;}<br />
                          :hover {background-position:0 0;}"></a></p>
<p>I hope I did a good job of explaining this, this is my first tutorial on here so any feedback would appreciated.</p>
<div style="clear:both; margin-bottom:100px;"></div>
]]></content:encoded>
			<wfw:commentRss>http://wirthdesign.com/blog/tutorial-create-a-simple-css-image-rollover.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
