<?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>CSS Sprites Archives - Michael Soriano</title>
	<atom:link href="https://michaelsoriano.com/tag/css-sprites/feed/" rel="self" type="application/rss+xml" />
	<link>https://michaelsoriano.com/tag/css-sprites/</link>
	<description>I turn code into captivating user experiences for the web</description>
	<lastBuildDate>Fri, 22 May 2009 07:48:37 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.7.4</generator>
	<item>
		<title>Create A Subscribe Bar with CSS Sprites</title>
		<link>https://michaelsoriano.com/create-a-subscribe-bar-with-css-sprites/</link>
					<comments>https://michaelsoriano.com/create-a-subscribe-bar-with-css-sprites/#comments</comments>
		
		<dc:creator><![CDATA[Michael Soriano]]></dc:creator>
		<pubDate>Fri, 22 May 2009 07:48:37 +0000</pubDate>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS Sprites]]></category>
		<category><![CDATA[Photoshop]]></category>
		<guid isPermaLink="false">http://fearlessflyer.com/?p=511</guid>

					<description><![CDATA[<p>Having a subscribe bar is almost a necessity for modern websites. This organizes your reader&#8217;s options on how to stay informed of your updates and new posts. May it be through Twitter, RSS, Email or even Facebook &#8211; you can display this bar in almost any part of your web pages. The following will teach [&#8230;]</p>
<p>The post <a href="https://michaelsoriano.com/create-a-subscribe-bar-with-css-sprites/">Create A Subscribe Bar with CSS Sprites</a> appeared first on <a href="https://michaelsoriano.com">Michael Soriano</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Having a subscribe bar is almost a necessity for modern websites. This organizes your reader&#8217;s options on how to stay informed of your updates and new posts. May it be through Twitter, RSS, Email or even Facebook &#8211; you can display this bar in almost any part of your web pages.<br />
<img fetchpriority="high" decoding="async" class="alignnone size-full wp-image-5886" src="https://michaelsoriano.com/wp-content/uploads/2009/05/css-sprites.gif" alt="css-sprites" width="596" height="205" /><br />
The following will teach you how to create a subscribe bar from scratch using Photoshop and a CSS technique known as sprites.<br />
<a class="viewdemo" href="http://demo.michaelsoriano.com/css-sprites/" rel="nofollow">View Demo</a></p>
<h3>Part 1 &#8211; Creating the Image</h3>
<p>In Photoshop, create a new image 432 pixels by 78 pixels. Add a title for your bar, and four icons of your subscription options. In our case, we&#8217;re using an RSS feed icon, Twitter, Email and Facebook. *Icons are from <a href="http://wefunction.com/2009/05/free-social-icons-app-icons/">WeFunction</a> Collection. Line them up and space them evenly.<br />
<img decoding="async" class="alignnone size-full wp-image-515" title="start with the active layer in Photoshop" src="https://michaelsoriano.com/wp-content/uploads/2009/05/social-0.jpg" alt="social-0" width="576" height="374" /><br />
Add guides that divide each button. Also be sure to add a guide right on the top of the document. Lock the guides in place – you will need these dimensions when creating the CSS.<br />
<img decoding="async" class="alignnone size-full wp-image-516" title="shown with guides" src="https://michaelsoriano.com/wp-content/uploads/2009/05/social-01.jpg" alt="social-01" width="576" height="375" /><br />
Multiply the canvas height by two. Make sure you click the button that keeps the canvas flushed to the bottom<br />
<img decoding="async" class="alignnone size-full wp-image-518" title="Double the canvas size" src="https://michaelsoriano.com/wp-content/uploads/2009/05/social-02.jpg" alt="social-02" width="576" height="338" /><br />
Select all existing layers and create a duplicate set. Merge all the layers in that set to create a single layer which we’ll use for the hover effect of the links.<br />
<img decoding="async" class="alignnone size-full wp-image-517" title="Duplicate all the layers" src="https://michaelsoriano.com/wp-content/uploads/2009/05/social-11.jpg" alt="social-1" /><br />
Nudge the new layer upwards – make sure it’s lined up exactly as the bottom layers. To create a hover effect – I desaturate the layer all the way to the max – making it a grayscale layer.<br />
<img decoding="async" class="alignnone size-full wp-image-520" title="Convert the buttons to greyscale" src="https://michaelsoriano.com/wp-content/uploads/2009/05/social-03.jpg" alt="social-03" width="576" height="370" /><br />
Make sure you hide the background layer and save the image as a .png.</p>
<h3>Part 2 &#8211; The HTML</h3>
<p>We’re going to need a single div and an unordered list of links to render the sprites. Make sure to add an id for each anchor tag. This is how we’ll match the image through our stylesheet.<br />
<script src="https://gist.github.com/michaelsoriano/649255359c567bfd0d46.js"></script><br />
Of course you have to replace the # with your links. Note that the first list item is not a link. This is just a placeholder for the title “Keep Updated” title.</p>
<h3>Part 3 – The CSS</h3>
<p><script src="https://gist.github.com/michaelsoriano/b572e4cac59602c24960.js"></script><br />
The first selector (#subscribe-div) can contain general properties of your bar. This includes overall padding, margins or positioning. The second selector (#subscribe-div ul#subsc li) – lets the browser know to display list items horizontally. The third (#subscribe-div ul#subsc li a) – calls our .png image.<br />
<script src="https://gist.github.com/michaelsoriano/6f35dc8fa020e740a6f2.js"></script><br />
<img decoding="async" class="alignnone size-full wp-image-519" title="the list items after some styling" src="https://michaelsoriano.com/wp-content/uploads/2009/05/social-2.jpg" alt="social-2" width="576" height="225" /><br />
This styles our list item bar-title with the “Keep Updated” leftmost section of our .png image – hence the position of 0 0 (means coordinates of 0 and 0). Next is styling the normal state of the links:<br />
<script src="https://gist.github.com/michaelsoriano/94df86b0fc9a7b8982ec.js"></script><br />
The above code reflects the normal state of the buttons in our list. The only properties applied are width and background position. To get the width of each button, you have to go back to your .psd (remember applying the guides in the beginning of the tutorial). Note that not all the buttons are identical in size, thus varying in widths. To get the background position, always remember: the first value is the left coordinate and the next value is top. Since we already know that our title is 156 pixels, we know our first button (rss) is going to have a background position of -156px.<br />
<img decoding="async" class="alignnone size-full wp-image-514" title="the list items after more styling!" src="https://michaelsoriano.com/wp-content/uploads/2009/05/social-3.jpg" alt="social-3" width="576" height="225" /><br />
Next is the hover state.<br />
<script src="https://gist.github.com/michaelsoriano/038a2747e45b2cb1d25f.js"></script><br />
Notice I just copied the code for the normal state and re-pasted it. The only difference is the use of anchor pseudo class :hover is appended to the “a” selector, and the top value of background position is now 78 pixels. This is because we want the .png image to shift 78 pixels downward, once the mouse is hovered over each link.<br />
The only thing left to do is to indent the text of the links. This is done in the #subscribe-div ul#subsc li a selector (text-indent:-9999px;).<br />
And that&#8217;s it. We have finished creating a subscribe bar from an image in Photoshop, HTML and finally adding some styles with CSS. You can <strong>download the source code from <a href="https://app.box.com/s/8mpg16any5wec8wbrucg">here</a>.</strong></p>
<p>The post <a href="https://michaelsoriano.com/create-a-subscribe-bar-with-css-sprites/">Create A Subscribe Bar with CSS Sprites</a> appeared first on <a href="https://michaelsoriano.com">Michael Soriano</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://michaelsoriano.com/create-a-subscribe-bar-with-css-sprites/feed/</wfw:commentRss>
			<slash:comments>11</slash:comments>
		
		
			</item>
	</channel>
</rss>
