<?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>Code a la Mode</title>
	<atom:link href="http://www.codealamode.net/feed" rel="self" type="application/rss+xml" />
	<link>http://www.codealamode.net</link>
	<description>Helpful Code Hints &#38; Tutorials</description>
	<lastBuildDate>Wed, 06 Jul 2011 21:45:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Water Conservation Graphic</title>
		<link>http://www.codealamode.net/water-conservation-icon</link>
		<comments>http://www.codealamode.net/water-conservation-icon#comments</comments>
		<pubDate>Sun, 03 Oct 2010 10:55:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[water conservation]]></category>
		<category><![CDATA[water graphic]]></category>
		<category><![CDATA[water icon]]></category>

		<guid isPermaLink="false">http://www.codealamode.net/?p=922</guid>
		<description><![CDATA[The topic for 2010&#8242;s Blog Action Day is water conservation. I made a water conservation vector graphic years ago that I&#8217;ve never actually used, so I figured I&#8217;d put it out there for any bloggers to use in their water-conservation-themed &#8230; <a href="http://www.codealamode.net/water-conservation-icon">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>The topic for 2010&#8242;s <a href="http://blogactionday.change.org/">Blog Action Day</a> is water conservation. I made a water conservation vector graphic years ago that I&#8217;ve never actually used, so I figured I&#8217;d put it out there for any bloggers to use in their water-conservation-themed posts (or anywhere they please).<span id="more-922"></span> Do whatever you like with the graphic, attribution is appreciated but not required.
<div class="post_img"><a href="http://www.codealamode.net/wp-content/uploads/2010/10/waterdrop.png"><img src="http://www.codealamode.net/wp-content/uploads/2010/10/waterdrop-300x300.png" alt="water conservation icon" title="water conservation graphic" width="300" height="300" class="aligncenter size-medium wp-image-933" /></a></div>
<p><a href='http://www.codealamode.net/wp-content/uploads/2010/10/waterdrop.zip'>Download</a><br />
<script type="text/javascript" src="http://www.change.org/widgets/content/petition_scroller_js?width=600&#038;causes=all&#038;color=00B1FF&#038;partner=1654-164"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.codealamode.net/water-conservation-icon/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tumblr: More posts per page</title>
		<link>http://www.codealamode.net/tumblr-more-posts-per-page</link>
		<comments>http://www.codealamode.net/tumblr-more-posts-per-page#comments</comments>
		<pubDate>Sat, 18 Sep 2010 13:07:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[posts-per-page]]></category>
		<category><![CDATA[tumblr]]></category>

		<guid isPermaLink="false">http://www.codealamode.net/?p=909</guid>
		<description><![CDATA[I&#8217;ve lately been messing around with the Tumblr platform, and am pretty impressed overall with what can be achieved with a free blogging platform. I&#8217;ve been working on a tumblr theme for portfolio creation (more on that later&#8230;) and came &#8230; <a href="http://www.codealamode.net/tumblr-more-posts-per-page">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve lately been messing around with the Tumblr platform, and am pretty impressed overall with what can be achieved with a free blogging platform. I&#8217;ve been working on a tumblr theme for portfolio creation (more on that later&#8230;) and came across the problem of not being able to display more than 15 posts per page. After a some digging, copying and pasting, and a bit of cleverness, I have the beginnings of a solution.<span id="more-909"></span> I came up with a bit of code which will let you load all pages at once. I haven&#8217;t thought about how this would be integrated into a proper tumblr theme, because that&#8217;s not really my goal at the moment, perhaps someone else will have a solution. For now it&#8217;s more of a proof of concept. Much of the code is borrowed from <a href="http://www.tumblr.com/theme/979">Fluid Theme </a></p>
<p>First you need to set up the start_page variable somewhere at the bottom of your page. Or anywhere.</p>
<pre class="brush: xml; title: ; notranslate">&lt;/pre&gt;
&lt;div id=&quot;hidden_navinfo&quot;&gt;&lt;!-- this is necessary for ajax pagination --&gt;&lt;span class=&quot;startpage&quot;&gt;{CurrentPage}&lt;/span&gt;&lt;span class=&quot;totalpages&quot;&gt;{TotalPages}&lt;/span&gt;&lt;/div&gt;
&lt;pre&gt;
</pre>
<p>This is the script that makes it go:</p>
<pre class="brush: jscript; title: ; notranslate">
$(document).ready(function() {
   var totalPages = $(&quot;#hidden_navinfo .totalpages&quot;).text();
   for ( var i = 1, len = totalPages; i &lt; len; i++) {
		var count = i+1;
		var new_posts = &quot;&quot;;
		$.get(&quot;/page/&quot; + count, function(data) {
		 	$(&quot;#posts&quot;).append($('.page', $(data)));
		});

	}
});
</pre>
<p>This assumes that your posts are wrapped in one div with the class of &#8220;page&#8221; and another with the id of &#8220;posts&#8221;. The extra &#8220;page&#8221; div isn&#8217;t ideal, but it prevents nesting problems. Here&#8217;s an example of the very stripped down theme code I have:</p>
<pre class="brush: xml; title: ; notranslate">

  {Title}{block:PostTitle} - {PostTitle}{/block:PostTitle}
&lt;script type=&quot;text/javascript&quot; src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js&quot;&gt;// &lt;![CDATA[

// ]]&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;&gt;// &lt;![CDATA[
	$(document).ready(function() {
   var totalPages = $(&quot;#hidden_navinfo .totalpages&quot;).text();
   for ( var i = 1, len = totalPages; i &lt; len; i++) {
		var count = i+1;
		var new_posts = &quot;&quot;;
		$.get(&quot;/page/&quot; + count, function(data) {
		 	$(&quot;#posts&quot;).append($('.page', $(data)));
		});

	}
});

// ]]&gt;&lt;/script&gt;

&lt;/pre&gt;
&lt;div id=&quot;content&quot;&gt;
&lt;h1&gt;&lt;a href=&quot;/&quot;&gt;{Title}&lt;/a&gt;&lt;/h1&gt;
&lt;h2&gt;{Description}&lt;/h2&gt;
&lt;div id=&quot;posts&quot;&gt;
&lt;div class=&quot;page&quot;&gt;{block:Posts}

 {block:Photo}
&lt;div class=&quot;box&quot;&gt;&lt;img src=&quot;{PhotoURL-250}&quot; alt=&quot;{PhotoAlt}&quot; /&gt;
 {block:Tags}
 &lt;a class=&quot;tag&quot; href=&quot;{TagURL}&quot;&gt;{URLSafeTag}&lt;/a&gt;
 {/block:Tags}&lt;/div&gt;
&lt;!-- post --&gt;
 {/block:Photo}

 {block:Video}
&lt;div class=&quot;box&quot;&gt;{Video-250}
 {block:Tags}
 &lt;a class=&quot;tag&quot; href=&quot;{TagURL}&quot;&gt;{URLSafeTag}&lt;/a&gt;
 {/block:Tags}&lt;/div&gt;
&lt;!-- post --&gt;
 {/block:Video}

 {/block:Posts}&lt;/div&gt;
&lt;!-- page --&gt;&lt;/div&gt;
&lt;!-- posts --&gt;
&lt;div id=&quot;hidden_navinfo&quot;&gt;&lt;!-- this is necessary for ajax pagination --&gt;
 &lt;span class=&quot;startpage&quot;&gt;{CurrentPage}&lt;/span&gt;&lt;span class=&quot;totalpages&quot;&gt;{TotalPages}&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;pre&gt;
</pre>
<p>Please let me know of any ideas for improvement!</p>
<p>UPDATE: Sorry guys, I really don&#8217;t have the answers to any of your questions, I&#8217;m not much of a Javascript pro, and was more just doing this to see if it sparked any ideas in others. I am, however, planning to revisit this eventually when I have time to learn some more javascript. Thanks!</p>
<p><a href="https://www.e-junkie.com/ecom/gb.php?ii=805170&#038;c=ib&#038;aff=139636&#038;cl=12635" target="ejejcsingle"><img src="http://rockable.s3.amazonaws.com/Affiliates/theme_tumblr/tumblr_728x90.gif" alt="theme tumblr like a pro" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.codealamode.net/tumblr-more-posts-per-page/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Hand-picked PSD to HTML Tutorials that Teach Stuff Right!</title>
		<link>http://www.codealamode.net/hand-picked-psd-to-html-tutorials-that-teach-stuff-right</link>
		<comments>http://www.codealamode.net/hand-picked-psd-to-html-tutorials-that-teach-stuff-right#comments</comments>
		<pubDate>Wed, 23 Dec 2009 23:21:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Roundups]]></category>
		<category><![CDATA[beginner css]]></category>
		<category><![CDATA[beginner html]]></category>
		<category><![CDATA[best html tutorials]]></category>
		<category><![CDATA[best psd to html tutorial]]></category>
		<category><![CDATA[css tutorial]]></category>
		<category><![CDATA[psd slicing tutorial]]></category>
		<category><![CDATA[psd slicing tutorials]]></category>
		<category><![CDATA[psd to html]]></category>
		<category><![CDATA[psd to html/css tutorial]]></category>
		<category><![CDATA[xhtml tutorial]]></category>

		<guid isPermaLink="false">http://www.codealamode.net/?p=781</guid>
		<description><![CDATA[When I first started out learning HTML and CSS, there was no shortage of tutorials all over the web explaining how to code PSDs into HTML. I surely read and followed dozens of them, but only a few really stuck &#8230; <a href="http://www.codealamode.net/hand-picked-psd-to-html-tutorials-that-teach-stuff-right">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>When I first started out learning HTML and CSS, there was no shortage of tutorials all over the web explaining how to code PSDs into HTML. I surely read and followed dozens of them, but only a few really stuck with me and really helped me. <span id="more-781"></span>There are endless exhaustive roundups of these tutorials, but they focus on quantity over quality.Many of the tutorials I came across taught me a lot of bad habits which took time to break, so I&#8217;m offering this short list as a way to sift through the junk and find the really valuable tutorials.</p>
<p>Many of the tutorials I came across while doing research were not necessarily <em>wrong</em>, but their approaches weren&#8217;t the best for teaching newcomers to the field, for one thing, many of them focused too heavily on CSS too early on in the process, which isn&#8217;t wrong, but I believe you should always focus on a solid markup structure before worrying about styling. Disagree? Let me know! Enjoy!</p>
<h4><a href="http://net.tutsplus.com/site-builds/from-psd-to-html-building-a-set-of-website-designs-step-by-step/" target="_blank">From PSD to HTML, Building a Set of Website Designs Step by Step</a> by Collis Ta&#8217;eed</h4>
<div class="post_img"><a href="http://net.tutsplus.com/site-builds/from-psd-to-html-building-a-set-of-website-designs-step-by-step/"><img src="http://www.codealamode.net/wp-content/uploads/2009/12/creatif-tutorial.jpg" alt="" title="creatif-tutorial" width="450" height="259" class="aligncenter size-full wp-image-942" /></a></div>
<p>This is a massive, thorough tutorial over at Nettuts that I highly recomend. Collis started PSDtuts ages ago and is certainly a reputable web developer and designer, and his tutorials always follow best practices. You can trust pretty much anything he writes.</p>
<h4><a href="http://www.blog.spoongraphics.co.uk/tutorials/encoding-a-photoshop-mockup-into-xhtml-css" target="_blank">Encoding a Photoshop Mockup into XHTML &amp; CSS</a> by Chris Spooner</h4>
<div class="post_img"><a href="http://www.blog.spoongraphics.co.uk/tutorials/encoding-a-photoshop-mockup-into-xhtml-css"><img src="http://www.codealamode.net/wp-content/uploads/2009/12/spoongraphics-tut.jpg" alt="" title="spoongraphics-tut" width="450" height="236" class="aligncenter size-full wp-image-801" /></a></div>
<p>Chris Spooner is your go-to guy for all things CSS, and his tutorials never disappoint, they&#8217;re clear, and concise, but with thoughful and helpful commentary throughout, and you know that you&#8217;re learning how to do things the right way.</p>
<h4><a href="http://line25.com/tutorials/how-to-convert-a-photoshop-mockup-to-xhtml-css" target="_blank">How to Convert a Photoshop Mockup to XHTML/CSS</a> by Chris Spooner</h4>
<div class="post_img"><a href="http://line25.com/tutorials/how-to-convert-a-photoshop-mockup-to-xhtml-css"><img src="http://www.codealamode.net/wp-content/uploads/2009/12/line25-tut.jpg" alt="" title="line25-tut" width="450" height="264" class="aligncenter size-full wp-image-802" /></a></div>
<p>Another one by Chris Spooner, this is one of the first tutorials that I ever actually completed when I was first starting out, and one of the only ones that really helped me! I kept referring back to it time and time again in early days with HTML and CSS to see if he might have already answered my questions.</p>
<h4><a href="http://www.subcide.com/tutorials/csslayout/index.aspx" target="_blank">Creating a CSS layout from scratch</a></h4>
<div class="post_img"><a href="http://www.subcide.com/tutorials/csslayout/index.aspx"><img src="http://www.codealamode.net/wp-content/uploads/2009/12/css-tut.jpg" alt="" title="css-tut" width="450" height="279" class="aligncenter size-full wp-image-803" /></a></div>
<p>This is a really fantastic tutorial that takes you through the process step by step, from slicing to CSS coding, and everything in between, and clearly explains concepts along the way. This one was also essential for me when I was first starting out.</p>
<h4><a href="http://net.tutsplus.com/tutorials/html-css-techniques/how-to-design-and-code-a-flexible-website/" target="_blank">How to Design and Code a Flexible Website</a> by Myself!</h4>
<div class="post_img"><a href="http://net.tutsplus.com/tutorials/html-css-techniques/how-to-design-and-code-a-flexible-website/"><img src="http://www.codealamode.net/wp-content/uploads/2009/12/my-tut.jpg" alt="" title="my-tut" width="450" height="302" class="aligncenter size-full wp-image-804" /></a></div>
<p>And now for a bit of self-promotion, check out this tutorial I wrote over at Nettuts. I spent a good amount of time being very thorough and making sure I was teaching only best practices. This tutorial focuses on making a web page accesible and flexible to all viewers, &#8220;unbreakable&#8221; as it were. I got a lot of positive feedback on this tutorial and wound up in the &#8220;Best of Tuts Network&#8221; roundup in October.</p>
<h4><a href="http://net.tutsplus.com/videos/screencasts/how-to-convert-a-psd-to-xhtml/" target="_blank">How to Convert a PSD to XHTML </a>by Jeffrey Way</h4>
<div class="post_img"><a href="http://net.tutsplus.com/videos/screencasts/how-to-convert-a-psd-to-xhtml/"><img src="http://www.codealamode.net/wp-content/uploads/2009/12/way-tut.jpg" alt="" title="way-tut" width="450" height="300" class="aligncenter size-full wp-image-805" /></a></div>
<p>Another authority on HTML coding (and really all things internet&#8230;) Jeffrey Way is the editor over at Nettuts, and he routinely posts screencasts that are always massively helpful, he uses the Firefox plugn Web Developer so that you can see the changes he makes to the css in real time. I&#8217;m personally not much of a screencast fan (too impatient) but if you have the patience (and the bandwidth) all his screencasts are worth watching.</p>
<h3>Bonus: More shameless Self-promotion!</h3>
<h4><a href="http://www.codealamode.net/slicing-and-coding-a-psd-into-xhtml-part-one/" target="_blank">Slicing and Coding a PSD into XHTML</a></h4>
<div class="post_img"><a href="http://www.codealamode.net/slicing-and-coding-a-psd-into-xhtml-part-one"><img src="http://www.codealamode.net/wp-content/uploads/2009/12/41-e1261676430743.jpg" alt="" title="4" width="450" height="303" class="aligncenter size-full wp-image-725" /></a></div>
<p>Check out my brand new two-part tutorial for coding a free PSD template into XHTML and CSS! Complete with lots of pictures for your viewing pleasure.</p>
<h4>Conclusion</h4>
<p>I hope you found some valuable resources here!  What do you think? What do you look for in a good tutorial? What are your impressions on the current stock of tutorials out there?</p>
<p><a href="https://www.e-junkie.com/ecom/gb.php?ii=680773&#038;c=ib&#038;aff=139636&#038;cl=12635" target="ejejcsingle"><img src="http://rockable.s3.amazonaws.com/Affiliates/photoshop_html_728x90.gif" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.codealamode.net/hand-picked-psd-to-html-tutorials-that-teach-stuff-right/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Slicing and Coding a PSD into XHTML &#8211; Part Two</title>
		<link>http://www.codealamode.net/slicing-and-coding-psd-into-xhtml-part-2</link>
		<comments>http://www.codealamode.net/slicing-and-coding-psd-into-xhtml-part-2#comments</comments>
		<pubDate>Thu, 24 Dec 2009 02:43:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[css tutorial]]></category>
		<category><![CDATA[html tutorial]]></category>
		<category><![CDATA[psd slicing tutorial]]></category>
		<category><![CDATA[psd to css]]></category>
		<category><![CDATA[psd to html]]></category>
		<category><![CDATA[psd to html/css tutorial]]></category>
		<category><![CDATA[xhtml tutorial]]></category>

		<guid isPermaLink="false">http://www.codealamode.net/?p=749</guid>
		<description><![CDATA[In part two of two, we&#8217;ll be taking our XHTML and our sliced up images and bringing them together into a the beautiful medley that is CSS. Step 1 &#8211; Setup and Reset Once you&#8217;ve linked to your external style &#8230; <a href="http://www.codealamode.net/slicing-and-coding-psd-into-xhtml-part-2">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>In part two of two, we&#8217;ll be taking our XHTML and our sliced up images and bringing them together into a the beautiful medley that is CSS. <span id="more-749"></span></p>
<h3>Step 1 &#8211; Setup and Reset</h3>
<p>Once you&#8217;ve linked to your external style sheet, we&#8217;re going to use a CSS reset, which gets rid of all the various default styles that browsers add, which can be inconsistent and cause all sorts of problems. I use a simplified version of  <a href="http://meyerweb.com/eric/tools/css/reset/" target="_blank">Eric Meyer&#8217;s CSS Reset</a>. We can also set some basic styles for the body of the document, including background colour and font-family.</p>
<pre class="brush: css; title: ; notranslate">
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
	margin: 0;
	padding: 0;
	border: 0;
	outline: 0;
	font-size: 100%;
	vertical-align: baseline;
	background: transparent;
}

body {
	background: #f7f4d5;
	font-family: &quot;Trebuchet MS&quot;, Verdana, sans-serif;
}
</pre>
<p>Looks good, now we need to set the width of the document&#8217;s outer container, which is the width of our main background image, 1000px. To center it, we need to set the left and right margins to auto. Let&#8217;s add in the background image while we&#8217;re at it. To get the space between the top of the page and the background image, measure it using the ruler tool (I). It looks like about 28px.</p>
<pre class="brush: css; title: ; notranslate">
#container {
	background: url('images/main_bg.jpg') no-repeat top;
	margin: 28px auto 0 auto;
	width: 1000px;
}
</pre>
<p>I&#8217;m specifying the margin values using css shorthand, which starts at top and goes clockwise around, so this shorthand means we have a top margin of 28px, left and right margins set to auto, and no bottom margin. We need to push the header down a bit, so on your PSD measure the distance from the top of the header image to the top of the main background image. Measure carefully and zoom in if you have to, because we need all those boxes to line up perfectly. I measured 67px.</p>
<pre class="brush: css; title: ; notranslate">
padding-top: 67px
</pre>
<h3>Step 2 &#8211; The Header</h3>
<p>Let&#8217;s add in the header background image first, then we can figure out how to position it properly. The header image is 859px wide, and also centered, so let&#8217;s set that too.</p>
<pre class="brush: css; title: ; notranslate">
#header {
	width: 859px;
	margin: 0 auto;
	background: url('images/header_bg.jpg') no-repeat top;
}
</pre>
<p>Now we need to position the content within the header. First, however, we need to replace the header text with image so we know how much space we&#8217;re working with. I&#8217;m using an image replacement technique where I set the image as the background, and set the text-indent property to something ridiculous like -9999px, so the original text doesn&#8217;t appear on the screen, but remains in the markup. When we replace text with images, we need to define the height and width of the image so that they expand properly.</p>
<pre class="brush: css; title: ; notranslate">
#header h1 {
	background:url('images/logo.jpg') no-repeat;
	text-indent: -9999px;
	height: 60px;
	width: 366px;
}
</pre>
<p>Now we need to position it, measure the distance from the top of the logo to the top of the header, and the side of the logo to the side of the header, I measured 67px and 45px repsectively. We&#8217;re going to add the 67px to the top padding of the containing element, and give the h1 a left margin of 45px.</p>
<pre class="brush: css; title: ; notranslate">
#header {
	width: 859px;
	margin: 0 auto;
	background: url('images/header_bg.jpg') no-repeat top;
	padding-top:67px;
}

#header h1 {
	background:url('images/logo.jpg') no-repeat;
	text-indent: -9999px;
	height: 60px;
	width: 366px;
	margin-left: 45px;
}
</pre>
<p>Our logo should now be nicely lined up. On to the paragraph underneath, we just need to add the same left margin of 45px, make the text smaller and a different colour, and set a width so that the line breaks happen in the right places (generally the width of the text box)</p>
<pre class="brush: css; title: ; notranslate">
#header p {
	font-size: 13px;
	color: #6b3603;
	margin-left: 49px;
	width: 365px;
	line-height: 15px;
	padding-top: 4px;
}
</pre>
<p>I also added a line-height of 15px, and a tiny bit of padding at the top. Now all that&#8217;s left to do is add some space at the bottom of the header and we&#8217;re done. We find this value by measuring from the bottom of the paragraph to the top of the navigation bar, and add it as bottom padding on the header div.</p>
<pre class="brush: css; title: ; notranslate">
#header {
	width: 859px;
	margin: 0 auto;
	background: url('images/header_bg.jpg') no-repeat top;
	padding: 67px 0 40px 0;
}
</pre>
<p>Notice that I used the shorthand property again instead of adding padding-bottom under the padding-top. Alright, that&#8217;s it for the header, you should have something like this:</p>
<div class="post_img"><a href="http://www.codealamode.net/wp-content/uploads/2009/12/13.jpg"><img class="aligncenter size-full wp-image-754" title="1" src="http://www.codealamode.net/wp-content/uploads/2009/12/13.jpg" alt="" width="600" height="285" /></a></div>
<h3>Step 3 &#8211; Navigation</h3>
<p>This part is a bit trickier, so pay close attention! First off, lets add the background colour to the entire containing div, as well as giving it a width and centering it (same width as the header: 859px).</p>
<pre class="brush: css; title: ; notranslate">
#navigation {
	width: 859px;
	margin: 0 auto;
	background: #e4a805;
}
</pre>
<p>We want the navigation links to be on the left side of the bar, and we want the search form on the right, so to do this we&#8217;re going to use opposing floats, the links floating left and the form floating right.</p>
<pre class="brush: css; title: ; notranslate">
#navigation ul {
	list-style: none;
	float: left;
}

#navigation form {
	float: right;
}
</pre>
<p>You&#8217;ll now notice that our background has gone away. This is because floating elements takes them out of the normal &#8220;flow&#8221; of the document, and so the rest of elements around them stop behaving well.  To restore order, we add overflow: hidden to the <em>parent element</em>.</p>
<pre class="brush: css; title: ; notranslate">
#navigation {
	width: 859px;
	margin: 0 auto;
	background: #e4a805;
	overflow: hidden;
}
</pre>
<p>Which leaves us with something like this:</p>
<div class="post_img"><a href="http://www.codealamode.net/wp-content/uploads/2009/12/22.jpg"><img class="aligncenter size-full wp-image-755" title="2" src="http://www.codealamode.net/wp-content/uploads/2009/12/22.jpg" alt="" width="600" height="211" /></a></div>
<p>Next, we need to add some space at the top and sides of the navigation bar, because the list and form aren&#8217;t aligned with the sides of the bar. Measure the distances from the top of the navigation bar to the top of the search form, from the right side of the &#8220;search&#8221; button to the right edge of the nav bar, and then repeat for the bottom and left. Add these values as padding to the navigation div, and check it in your browser. The navigation bar has now extended to the left and right! This is because block-level elements add padding, margins and borders to the width of the element, making them wider. To correct this problem, we need to subtract the left and right margin values from the width.</p>
<pre class="brush: css; title: ; notranslate">
#navigation {
	width: 806px;
	margin: 0 auto;
	background: #e4a805;
	overflow: hidden;
	padding: 13px 25px 10px 28px;
}
</pre>
<p>So we get this:</p>
<div class="post_img"><a href="http://www.codealamode.net/wp-content/uploads/2009/12/32.jpg"><img class="aligncenter size-full wp-image-756" title="3" src="http://www.codealamode.net/wp-content/uploads/2009/12/32.jpg" alt="" width="600" height="96" /></a></div>
<h4>Getting our links in a line</h4>
<p>To get our link items to display horizontally, we need to float them like we did earlier</p>
<pre class="brush: css; title: ; notranslate">
#navigation ul li {
	float:left;
}
</pre>
<p>This float didn&#8217;t cause us any problems because if you float an element that&#8217;s inside a floated element, all your problems go away! (for the most part). Next lets style the text, and add right margins to the list items. Measure the distance between the brown buttons in the navigation bar. The text styles have to apply to the anchor elements to change the colours and the underline, and the margins have to apply to the list items.</p>
<pre class="brush: css; title: ; notranslate">
#navigation ul li {
	float:left;
	margin-right: 17px;
}

#navigation ul li a {
	color: #ffffd6;
	text-decoration: none;
}
</pre>
<p>And our navigation is starting to look a lot better!</p>
<div class="post_img"><a href="http://www.codealamode.net/wp-content/uploads/2009/12/42.jpg"><img class="aligncenter size-full wp-image-757" title="4" src="http://www.codealamode.net/wp-content/uploads/2009/12/42.jpg" alt="" width="600" height="86" /></a></div>
<p>Now for the tricky part: the background images. If you haven&#8217;t already, I suggest you read an article about the concept of sliding doors, either the original on A List Apart, or just Google it, there are a lot of great tutorials out there. To start, we&#8217;re going to apply the left side image to our list items and position them on the left.</p>
<pre class="brush: css; title: ; notranslate">
#navigation ul li {
	background: url('images/nav_left.gif') no-repeat left;
	float:left;
	margin-right: 17px;
}
</pre>
<p>Next we add padding to the list items so that the background expands, so measure the distances around the text within the buttons. This part can be a bit fiddly, so just keep checkin in your browser until it looks right.</p>
<pre class="brush: css; title: ; notranslate">
#navigation ul li {
	background: url('images/nav_left.gif') no-repeat left;
	float:left;
	margin-right: 17px;
	padding: 8px 0px 8px 20px;
}
</pre>
<p>Next, we add the right half of the button image to the anchor tags, and add padding to the anchor tags so they expand fully. Again, you may need to mess around with these values a bit. Remember to position the background image to the right</p>
<pre class="brush: css; title: ; notranslate">
#navigation ul li {
	background: url('images/nav_left.gif') no-repeat left;
	float:left;
	margin-right: 17px;
	padding: 8px 0px 8px 20px;
}

#navigation ul li a {
	background: url('images/nav_right.gif') no-repeat right;
	color: #ffffd6;
	text-decoration: none;
	padding: 8px 20px 8px 8px;
}
</pre>
<p>And finally our navigation menu is finished!</p>
<div class="post_img"><a href="http://www.codealamode.net/wp-content/uploads/2009/12/52.jpg"><img class="aligncenter size-full wp-image-758" title="5" src="http://www.codealamode.net/wp-content/uploads/2009/12/52.jpg" alt="" width="600" height="66" /></a></div>
<h4>Fixing up the search form</h4>
<p>This part is pretty easy, we&#8217;re mostly just replacing default backgrounds with our own. Replace the input element with our searchfield image, and the submit button with our own brown search button. Input fields have borders by default, so we have to get rid of those too. Next, we need to add heights and some padding, again, this part can be tricky, especially the input field because there&#8217;s no text to measure around. We may as well do the text styling on the search button here too.</p>
<pre class="brush: css; title: ; notranslate">
#navigation form input#searchinput {
	background: url('images/input.gif') no-repeat;
	border: none;
	height: 32px;
	padding: 0 15px;
}

#navigation form input#searchsubmit {
	background: url('images/search_button.gif') no-repeat;
	border: none;
	height: 28px;
	width: 69px;
	font-size: 16px;
	color: #ffffd6;
	cursor: pointer;
}
</pre>
<p>And that&#8217;s it! we&#8217;re done with the navigation bar! Take a look: It&#8217;s a thing of beaty.</p>
<div class="post_img"><a href="http://www.codealamode.net/wp-content/uploads/2009/12/62.jpg"><img class="aligncenter size-full wp-image-759" title="6" src="http://www.codealamode.net/wp-content/uploads/2009/12/62.jpg" alt="" width="600" height="231" /></a></div>
<h3>Step 4 &#8211; Main Content</h3>
<p>Alright, let&#8217;s get started with the main content. First off, we need to set the width and center it, and add in our background image.</p>
<pre class="brush: css; title: ; notranslate">
#content {
	background: url('images/content_bg.jpg') no-repeat bottom;
	margin: 0 auto;
	width: 859px;
	padding-top:16px;
}
</pre>
<p>Notice that we positioned the image at the bottom so that no matter how much or little content we have, we always see the bottom border. We&#8217;ve also added some padding at the top, which is the distance from the bottom of the nav bar to the top of the pinkish background in the features modules. Next we need to work on the modules themselves. To get them to display horizontally, you guessed it, we need to float them. To prevent things from getting messy, we need to add the overflow:hidden rule to the containing element, which we called #features. The boxes won&#8217;t display beside eachother unless their combined widths are less than the width of the container, so we need to set a width for each box too.</p>
<pre class="brush: css; title: ; notranslate">
#features {
	overflow:hidden;
}

.feature {
	background: #f7f5e2;
	float: left;
	width: 245px;
}
</pre>
<p>Next we need to space our boxes out one by one, starting with the leftmost one, #exchange. The distance from the edge of the pinkish background to the edge of the content background will be the margin value, and then measure the distances between the boxes.</p>
<pre class="brush: css; title: ; notranslate">
#exchange {
	margin-left: 35px;
}

#remote {
	margin-left: 30px;
}

#training {
	margin-left: 23px;
}
</pre>
<p>Looks pretty good so far:</p>
<div class="post_img"><a href="http://www.codealamode.net/wp-content/uploads/2009/12/72.jpg"><img class="aligncenter size-full wp-image-760" title="7" src="http://www.codealamode.net/wp-content/uploads/2009/12/72.jpg" alt="" width="600" height="261" /></a></div>
<p>Next we need to style all the text in the boxes, including the h2 headers, which need to be replaced with images, using the same technique we used on the logo. Next, we measure the distances between all the elements in the boxes, and add padding and margin values</p>
<pre class="brush: css; title: ; notranslate">
.feature h2 {
	text-indent: -9999px;
	height: 21px;
	width: 145px;
	margin: 27px 0 10px 13px;
}

.feature h3 {
	font-size: 13px;
	color: #444439;
	margin-left: 13px;
	padding-left: 39px;
}

.feature p {
	color: #444439;
	font-size: 13px;
	line-height: 16px;
	padding-top: 10px;
	margin-left: 13px;
}

#exchange h2 {
	background: url('images/exchange_server.jpg') no-repeat;
}

#remote h2 {
	background: url('images/remote_desktop.jpg') no-repeat;
}

#training h2 {
	background: url('images/product_training.jpg') no-repeat;
}
</pre>
<p>The reason we need so much padding on the left of the h3 elements is because we need to add in the icons beside each heading:</p>
<pre class="brush: css; title: ; notranslate">
#exchange h3 {
	background: url('images/graph.jpg') no-repeat left;
}

#remote h3 {
	background: url('images/tool.jpg') no-repeat left;
}

#training h3 {
	background: url('images/page.jpg') no-repeat left;
}
</pre>
<p>To get all the boxes the same height, we have to add more padding to the bottom of the last box than the others, something like this:</p>
<pre class="brush: css; title: ; notranslate">
#exchange {
	margin-left: 35px;
	padding-bottom: 31px
}

#remote {
	margin-left: 30px;
	padding-bottom: 31px;
}

#training {
	margin-left: 23px;
	padding-bottom: 47px;
}
</pre>
<p>And that&#8217;s it, we&#8217;re done with those boxes!</p>
<div class="post_img"><a href="http://www.codealamode.net/wp-content/uploads/2009/12/81.jpg"><img class="aligncenter size-full wp-image-761" title="8" src="http://www.codealamode.net/wp-content/uploads/2009/12/81.jpg" alt="" width="600" height="174" /></a></div>
<h4>Second group of boxes</h4>
<p>To get our &#8220;sidebar&#8221; and &#8220;description&#8221; boxes beside eachother, we need to float them, too, which means we need to set a width value. Find the padding and margin values the same way we did with the other boxes, and set the background colours of the sidebar</p>
<pre class="brush: css; title: ; notranslate">
#sidebar {
	background: #f6f1ba;
	float: left;
	padding: 9px 0 18px 13px;
	margin: 18px 0 0 35px;
	width: 232px;
}

#description {
	float: left;
	margin: 18px 0 0 30px;
	width: 463px;
}
</pre>
<p>To prevent the footer from wrapping around the side, we set overflow:hidden on the parent element, which is the #content div.</p>
<pre class="brush: css; title: ; notranslate">
#content {overflow: hidden;}
</pre>
<p>Now we just need to style the text in the boxes, including the h2 image replacements.</p>
<pre class="brush: css; title: ; notranslate">
#sidebar h2 {
	background: url('images/sed_dolor.jpg') no-repeat;
	text-indent: -9999px;
	height: 17px;
	width: 134px;
	padding-bottom: 8px;
}

#sidebar ul {
	list-style: none;
}

#sidebar ul li {
	background: url('images/bullet.gif') no-repeat left;
	padding-left: 13px;
}

#sidebar ul li a {
	color: #444439;
	font-size: 13px;
}

#description h2 {
	background: url('images/integer_vel.jpg') no-repeat;
	text-indent: -9999px;
	width: 247px;
	height: 27px;
	padding-bottom: 12px;
}

#description p {
	font-size: 13px;
	color: #444439;
	line-height: 16px;
}
</pre>
<p>Let&#8217;s just add some padding to the bottom of the content div, and there, we&#8217;re basically done with the main content!</p>
<pre class="brush: css; title: ; notranslate">
#content {
	background: url('images/content_bg.jpg') no-repeat bottom;
	margin: 0 auto;
	overflow: hidden;
	width: 859px;
	padding: 16px 0 35px 0;
}
</pre>
<div class="post_img"><a href="http://www.codealamode.net/wp-content/uploads/2009/12/91.jpg"><img class="aligncenter size-full wp-image-762" title="9" src="http://www.codealamode.net/wp-content/uploads/2009/12/91.jpg" alt="" width="600" height="287" /></a></div>
<h4>Internet Explorer 6 double-margin bug</h4>
<p>If we look at our page in IE6, some of the margins are doubled up! This is because of an IE6 bug which causes margins on floated elements to double on the side of the float, such that if you float an element to the left, the margin-left will be doubled, and the reverse for elements floated to the right. Fortuneatly, the fix for this bug is really simple, we just need to apply display:inline to the floated element!</p>
<pre class="brush: css; title: ; notranslate">
.feature {
	background: #f7f5e2;
	float: left;
	width: 245px;
	display: inline;
}
#sidebar {
	background: #f6f1ba;
	float: left;
	padding: 9px 0 18px 13px;
	margin: 18px 0 0 35px;
	width: 232px;
	display: inline;
}
</pre>
<p>There we go, all fixed!</p>
<h3>Step 6 &#8211; Footer</h3>
<p>All that&#8217;s left to do is style the footer, which should be pretty simple, so see if you can figure it out yourself, here&#8217;s what we need to do:</p>
<ol>
<li>Declare the width and make the footer centered</li>
<li>Change the text styles</li>
<li>Float the unordered list of navigation links to the left, and the copyright text to the right</li>
<li>Get the list items displaying in a row</li>
<li>Fix the double-margin but on the ul</li>
</ol>
<p>Can you figure it out?</p>
<p>Okay, here&#8217;s the answer:</p>
<pre class="brush: css; title: ; notranslate">
#footer {
	margin: 0 auto;
	overflow: hidden;
	padding: 18px 0 60px 0;
	width: 859px;
}

#footer ul {
	list-style: none;
	float: left;
	margin-left: 67px;
	display: inline;
}

#footer ul li {
	float: left;
	padding-right: 16px;
}

#footer ul li a {
	color: #6b3603;
	font-size: 13px;
}

#footer p {
	color: #6b3603;
	float: right;
	font-size: 13px;
	display: inline;
	margin-right: 114px;
}
</pre>
<div class="post_img"><a href="http://www.codealamode.net/wp-content/uploads/2009/12/112.jpg"><img class="aligncenter size-full wp-image-763" title="11" src="http://www.codealamode.net/wp-content/uploads/2009/12/112.jpg" alt="" width="600" height="121" /></a></div>
<p>And that&#8217;s it! we&#8217;re done! We&#8217;ve successfully coded up a fairly complex PSD template into valid, semantic XHTML and CSS!</p>
<p><em>Note: One generally shouldn&#8217;t size text in absolute units like pixels, because it can&#8217;t be resized in earlier versions of Internet Explorer, so you should be using ems, I just didn&#8217;t really want to get into it here, because I already mentioned it in <a href="http://net.tutsplus.com/tutorials/html-css-techniques/how-to-design-and-code-a-flexible-website/">this Nettuts tutorial</a>. You have to scroll down a bit to around step 11</em></p>
<p><strong><a href="http://www.codealamode.net/wp-content/uploads/2009/remotetutorial/index.html">View Demo</a></strong><br />
<a href="https://www.e-junkie.com/ecom/gb.php?ii=680773&#038;c=ib&#038;aff=139636&#038;cl=12635" target="ejejcsingle"><img src="http://rockable.s3.amazonaws.com/Affiliates/photoshop_html_728x90.gif" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.codealamode.net/slicing-and-coding-psd-into-xhtml-part-2/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Slicing and Coding a PSD into XHTML &#8211; Part One</title>
		<link>http://www.codealamode.net/slicing-and-coding-a-psd-into-xhtml-part-one</link>
		<comments>http://www.codealamode.net/slicing-and-coding-a-psd-into-xhtml-part-one#comments</comments>
		<pubDate>Tue, 22 Dec 2009 23:27:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[css tutorial]]></category>
		<category><![CDATA[html tutorial]]></category>
		<category><![CDATA[psd slicing tutorial]]></category>
		<category><![CDATA[psd to css]]></category>
		<category><![CDATA[psd to html]]></category>
		<category><![CDATA[psd to html/css tutorial]]></category>
		<category><![CDATA[xhtml tutorial]]></category>

		<guid isPermaLink="false">http://www.codealamode.net/?p=711</guid>
		<description><![CDATA[In this tutorial, we&#8217;re going to be taking a PSD webpage template and coding it into XHTML and CSS. Along the way, I&#8217;m going to explain how to approach the coding of a webpage, so that hopefully, after reading, you&#8217;ll &#8230; <a href="http://www.codealamode.net/slicing-and-coding-a-psd-into-xhtml-part-one">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>In this tutorial, we&#8217;re going to be taking a PSD webpage template and coding it into XHTML and CSS. Along the way, I&#8217;m going to explain how to approach the coding of a webpage, so that hopefully, after reading, you&#8217;ll be able to apply what you&#8217;ve learned to your own designs. <span id="more-711"></span>First off, let&#8217;s grab that PSD. I&#8217;m using a free template available online because I&#8217;d like to focus on the coding here, not the design. Go ahead and grab the free template at <a href="http://www.bevelandemboss.net/show-template.php?id=15">Bevel and Emboss</a> and open it up in photoshop.</p>
<h3>Step 1 &#8211; Plan of attack!</h3>
<p>We have a pretty simple layout, all the content is contained within one large container, which we&#8217;ll call #container. The header and navigation will have their own divs, and the main content section will have one large div and several smaller ones inside. The footer gets its own div too. I find it helpful to plan out your code visually, especially with more complex designs. This is my idea of what we&#8217;re doing:</p>
<div class="post_img"><a href="http://www.codealamode.net/wp-content/uploads/2009/12/demo.jpg"><img src="http://www.codealamode.net/wp-content/uploads/2009/12/demo.jpg" alt="markup plan" title="demo" width="600" height="402" class="aligncenter size-full wp-image-712" /></a></div>
<h3>Step 2 &#8211; XHTML</h3>
<h4>Setup</h4>
<p>Open up your favourite code editor, and set up a basic xhtml document, and add in our outer divs.</p>
<pre class="brush: xml; title: ; notranslate">
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;
&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; xml:lang=&quot;en&quot; lang=&quot;en&quot;&gt;
&lt;head&gt;
	&lt;title&gt;Remote Server 2009&lt;/title&gt;
	&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot; /&gt;
&lt;/head&gt;
&lt;body&gt;
	&lt;div id=&quot;container&quot;&gt;

		&lt;div id=&quot;header&quot;&gt;
		&lt;/div&gt;&lt;!-- end header --&gt;

		&lt;div id=&quot;navigation&quot;&gt;
		&lt;/div&gt;&lt;!-- end navigation --&gt;

		&lt;div id=&quot;content&quot;&gt;
		&lt;/div&gt;&lt;!-- end content --&gt;

		&lt;div id=&quot;footer&quot;&gt;
	       &lt;/div&gt;&lt;!-- end footer --&gt;
        &lt;/div&gt;&lt;!--end container--&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<h4>Header</h4>
<p>For the header, we&#8217;re only going to code in the main headline &#8220;Remote Server&#8221; and the paragraph underneath, without the leading &#8220;lorem ipsum.&#8221; This is because we&#8217;re going to replace the leading text and headline with an image, because the font used isn&#8217;t web-safe. I&#8217;m leaving out the leading text because I doubt it&#8217;s of much importance, however, if the words were essential to the meaning of the site or were keywords you&#8217;d want to show up in search engines, you should allways have them hard coded in.</p>
<pre class="brush: xml; title: ; notranslate">
&lt;div id=&quot;header&quot;&gt;
	&lt;h1&gt;&lt;a href=&quot;#&quot;&gt;Remote Server 2009&lt;/a&gt;&lt;/h1&gt;
	 &lt;p&gt;Sollicitudin a dapibus in, iaculis ut nisl. Praesent non diam at dignissim eros. Praesent ornare. &lt;/p&gt;
&lt;/div&gt;&lt;!-- end header --&gt;
</pre>
<h4>Navigation</h4>
<p>Next, we code up the navigation div, which contains both the navigation links and a search form. The navigation links will be coded as an unordered list, and the form (duh) as a form.</p>
<pre class="brush: xml; title: ; notranslate">
&lt;div id=&quot;navigation&quot;&gt;
			&lt;ul&gt;
				&lt;li&gt;&lt;a href=&quot;#&quot;&gt;Product Info&lt;/a&gt;&lt;/li&gt;
				&lt;li&gt;&lt;a href=&quot;#&quot;&gt;New Features&lt;/a&gt;&lt;/li&gt;
				&lt;li&gt;&lt;a id=&quot;order&quot; href=&quot;#&quot;&gt;Order now!&lt;/a&gt;&lt;/li&gt;
			&lt;/ul&gt;
			&lt;form action=&quot;post&quot;&gt;
				&lt;input type=&quot;text&quot; id=&quot;searchinput&quot; /&gt;
				&lt;input type=&quot;submit&quot; id=&quot;searchsubmit&quot; value=&quot;search&quot; /&gt;
			&lt;/form&gt;
		&lt;/div&gt;&lt;!-- end navigation --&gt;
</pre>
<p>We need to add the unique id of &#8220;order&#8221; to the order link, because it&#8217;s going to be a different colour.</p>
<h4>Content</h4>
<p>Inside the content we have the three boxes of features, which will be wrapped in individual divs with different id tags but each with the same class. The heading of each box will be an h2, and the sub-heading will be an h3. This is where having dummy content can be inconvenient, because the use of heading tags depends on the relevance of the information being displayed, however, I&#8217;m assuming the sub-headings here will be keyword-rich descriptions of each feature, therefore, they get an h3 tag.</p>
<pre class="brush: xml; title: ; notranslate">
&lt;div id=&quot;content&quot;&gt;
			&lt;div id=&quot;features&quot;&gt;

				&lt;div id=&quot;exchange&quot; class=&quot;feature&quot;&gt;
					&lt;h2&gt;Exchange server&lt;/h2&gt;
					&lt;h3&gt;Lorem ipsum dolor sit amet,
					consectetur adipiscing&lt;/h3&gt;
					&lt;p&gt;Curabitur neque turpis,
					sollicitudin a dapibus in, iaculis ut nisl.
					Praesent non diam at leo luctus scelerisque non in neque. Ut eget nisl&lt;/p&gt;
				&lt;/div&gt;&lt;!-- end exchange --&gt;

				&lt;div id=&quot;remote&quot; class=&quot;feature&quot;&gt;
					&lt;h2&gt;Remote Desktop&lt;/h2&gt;
					&lt;h3&gt;Praesent non diam at leo
					luctus non in neque.&lt;/h3&gt;
					&lt;p&gt;Curabitur neque turpis,
					sollicitudin a dapibus in, iaculis ut nisl.
					Praesent non diam at leo luctus scelerisque non in neque. Ut&lt;/p&gt;
				&lt;/div&gt;&lt;!-- end remote --&gt;

				&lt;div id=&quot;training&quot; class=&quot;feature&quot;&gt;
					&lt;h2&gt;Product Training&lt;/h2&gt;
					&lt;h3&gt;Praesent ornare volutpat
					metus at tristique. &lt;/h3&gt;
					&lt;p&gt;Vestibulum ante ipsum primis in
					faucibus orci luctus et ultrices posuere cubilia Curae; Aenean &lt;/p&gt;
				&lt;/div&gt;&lt;!-- end training --&gt;

			&lt;/div&gt;&lt;!-- end features --&gt;
		&lt;/div&gt;&lt;!-- end content --&gt;
</pre>
<h4>Sidebar</h4>
<p>I&#8217;m calling the small yellow box under the feature boxes a sidebar because I don&#8217;t really know what it is with just dummy content, but it seems reasonable, like before, it gets h2 headings, and the links are wrapped in an unordered list. The section next to the sidebar I&#8217;m calling description, and it&#8217;s going to be coded like the rest of hte content areas.</p>
<pre class="brush: xml; title: ; notranslate">
&lt;/div&gt;&lt;!-- end features --&gt;

			&lt;div id=&quot;sidebar&quot;&gt;
				&lt;h2&gt;Sed dolor enim&lt;/h2&gt;
				&lt;ul&gt;
					&lt;li&gt;&lt;a href=&quot;#&quot;&gt;Sed solicitudin&lt;/a&gt;&lt;/li&gt;
					&lt;li&gt;&lt;a href=&quot;#&quot;&gt;Urna et molestie&lt;/a&gt;&lt;/li&gt;
					&lt;li&gt;&lt;a href=&quot;#&quot;&gt;Pharetra, neque risus&lt;/a&gt;&lt;/li&gt;
				&lt;/ul&gt;
			&lt;/div&gt;&lt;!-- end sidebar --&gt;

			&lt;div id=&quot;description&quot;&gt;
				&lt;h2&gt;Integer vel tortor quis&lt;/h2&gt;
				&lt;p&gt;Sed sollicitudin, urna et molestie pharetra, neque risus vestibulum ligula, et pulvinar eros metus non purus. Donec consectetur, tellus et vestibulum cursus, metus risus sollicitudin tellus, vitae vehicula neque odio vitae lacus.&lt;/p&gt;
			&lt;/div&gt;&lt;!-- end description --&gt;

		&lt;/div&gt;&lt;!-- end content --&gt;
</pre>
<p>We&#8217;re almost done! now we just need to wrap the footer links in an unordered list, and put the copyright info in a paragraph.</p>
<pre class="brush: xml; title: ; notranslate">
&lt;div id=&quot;footer&quot;&gt;
			&lt;ul&gt;
				&lt;li&gt;&lt;a href=&quot;#&quot;&gt;Homepage&lt;/a&gt;&lt;/li&gt;
				&lt;li&gt;&lt;a href=&quot;#&quot;&gt;Product info&lt;/a&gt;&lt;/li&gt;
				&lt;li&gt;&lt;a href=&quot;#&quot;&gt;New Features&lt;/a&gt;&lt;/li&gt;
				&lt;li&gt;&lt;a href=&quot;#&quot;&gt;Order Now&lt;/a&gt;&lt;/li&gt;
			&lt;/ul&gt;
			&lt;p&gt;&amp;copy; Copyright 2009, Remote server, Lorem Ipsum&lt;/p&gt;
		&lt;/div&gt;&lt;!-- end footer --&gt;
</pre>
<p>And that&#8217;s it, we&#8217;re done the markup! If you check it out in your browser, it&#8217;s all organized logically and makes complete sense (in a lorem-ipsum kindof way) without any styling.</p>
<h3>Step 3 &#8211; Slicing the PSD</h3>
<p>The first thing we need is the large patterned background, so get out the slice tool (C) and slice out the whole patterned part (with content layers hidden!), try to make sure you get all of the patterned part before it fades into a solid pattern. The built-in guides should help here. Save the image as a high-ish quality JPEG.</p>
<div class="post_img"><a href="http://www.codealamode.net/wp-content/uploads/2009/12/12.jpg"><img class="aligncenter size-full wp-image-722" title="1" src="http://www.codealamode.net/wp-content/uploads/2009/12/12.jpg" alt="" width="600" height="446" /></a></div>
<p>Next we need the header background. We want to get in the top part of the navigation menu too, where it appears to fold around. To do this, drag guides out just to the edge of the navigation menu, and use these guides to slice the image. Save this image with the same settings as the last.</p>
<div class="post_img"><a href="http://www.codealamode.net/wp-content/uploads/2009/12/21.jpg"><img class="aligncenter size-full wp-image-723" title="2" src="http://www.codealamode.net/wp-content/uploads/2009/12/21.jpg" alt="" width="400" height="433" /></a></div>
<div class="post_img"><a href="http://www.codealamode.net/wp-content/uploads/2009/12/31.jpg"><img class="aligncenter size-full wp-image-724" title="3" src="http://www.codealamode.net/wp-content/uploads/2009/12/31.jpg" alt="" width="600" height="255" /></a></div>
<p>Okay, that&#8217;s the last of our background images, now we need the non-web-safe text images to replace our text with. Try to slice these as close as possible to make it easier to style. Save these as medium quality JPEGs.</p>
<div class="post_img"><a href="http://www.codealamode.net/wp-content/uploads/2009/12/41-e1261676430743.jpg"><img class="aligncenter size-full wp-image-725" title="4" src="http://www.codealamode.net/wp-content/uploads/2009/12/41-e1261676430743.jpg" alt="" width="600" height="404" /></a></div>
<p>Now for those icons &#8211; just slice &#8216;em up and save them as GIFs, don&#8217;t forget the bullet points in the sidebar! You may as well grab the search input box while we&#8217;re at it, we can save it as a GIF too.</p>
<div class="post_img"><a href="http://www.codealamode.net/wp-content/uploads/2009/12/51.jpg"><img class="aligncenter size-full wp-image-726" title="5" src="http://www.codealamode.net/wp-content/uploads/2009/12/51.jpg" alt="" width="600" height="404" /></a></div>
<p>We&#8217;re not quite done with the slicing yet, we still need those rounded buttons in the navigation menu. Instead of cutting out each individual button, we&#8217;re going to use a technique called &#8220;sliding doors&#8221; which Douglas Bowman describes in  <a href="http://www.alistapart.com/articles/slidingdoors/">This article at A List Apart</a>. For our purposes, since we&#8217;ve already got our anchors wrapped in list items, we don&#8217;t need to add span tags. Cut one of the buttons in half, stretch it out longer, and save the left and right slices as GIFs (you&#8217;ll have to rasterize the layer first). You can also grab the background of the search submit button, but turn of the text layer first.</p>
<div class="post_img"><a href="http://www.codealamode.net/wp-content/uploads/2009/12/61.jpg"><img class="aligncenter size-full wp-image-727" title="6" src="http://www.codealamode.net/wp-content/uploads/2009/12/61.jpg" alt="" width="600" height="291" /></a></div>
<p>Oops there&#8217;s one more image we should have gotten at the beginning, the background for the main content part. In case we add more content later, lets free transform it a bit bigger than we need (this also helps when IE renders text a bit bigger). Select both layers and drag them down a bit.</p>
<div class="post_img"><a href="http://www.codealamode.net/wp-content/uploads/2009/12/6.7.jpg"><img class="aligncenter size-full wp-image-728" title="6.7" src="http://www.codealamode.net/wp-content/uploads/2009/12/6.7.jpg" alt="" width="600" height="432" /></a></div>
<div class="post_img"><a href="http://www.codealamode.net/wp-content/uploads/2009/12/71.jpg"><img class="aligncenter size-full wp-image-729" title="7" src="http://www.codealamode.net/wp-content/uploads/2009/12/71.jpg" alt="" width="600" height="487" /></a></div>
<p>And those are all the images we need! Give them all meaningful names, and place them in the images folder in your site&#8217;s directory.</p>
<p>That&#8217;s it for today, On to part Two:</p>
<p><a href="http://www.codealamode.net/slicing-and-coding-psd-into-xhtml-part-2/">Slicing and Coding a PSD into XHTML &#8211; Part Two</a><br />
<a href="https://www.e-junkie.com/ecom/gb.php?ii=680773&#038;c=ib&#038;aff=139636&#038;cl=12635" target="ejejcsingle"><img src="http://rockable.s3.amazonaws.com/Affiliates/photoshop_html_728x90.gif" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.codealamode.net/slicing-and-coding-a-psd-into-xhtml-part-one/feed</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>CSS Overlapping Tabs</title>
		<link>http://www.codealamode.net/overlapping-tabs</link>
		<comments>http://www.codealamode.net/overlapping-tabs#comments</comments>
		<pubDate>Sun, 13 Dec 2009 08:00:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[css folder tabs]]></category>
		<category><![CDATA[css navigation]]></category>
		<category><![CDATA[css tabs]]></category>
		<category><![CDATA[overlapping tabbed navigation]]></category>
		<category><![CDATA[overlapping tabs]]></category>
		<category><![CDATA[tabbed navigation]]></category>

		<guid isPermaLink="false">http://localhost:8888/wordpress/?p=650</guid>
		<description><![CDATA[Tabs are great &#8211; They&#8217;re user-friendly because they&#8217;re like the real world, and they can add a great 3D element to a design. Overlapping tabs present a special challenge to code, but with some careful planning and clever images, we&#8217;ll &#8230; <a href="http://www.codealamode.net/overlapping-tabs">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Tabs are great &#8211; They&#8217;re user-friendly because they&#8217;re like the real world, and they can add a great 3D element to a design. Overlapping tabs present a special challenge to code, but with some careful planning and clever images, we&#8217;ll have some nicely interactive tabs. </p>
<p><span id="more-650"></span></p>
<p>We&#8217;re going to be using the &#8220;Sliding Doors&#8221; technique to make our tabs flexible, if you&#8217;ve never heard of the technique, check out the Douglas Bowman&#8217;s original article <a href="http://www.alistapart.com/articles/slidingdoors/">Sliding Doors of CSS</a> over at A List Apart.</p>
<h3>Step 1 &#8211; Photoshop</h3>
<p>Alright, fire up Photoshop, let&#8217;s get started! Let&#8217;s start making some tabs: I&#8217;m not going to go through the step-by-step process of making the tabs in photoshop, because Collis Ta&#8217;eed describes the process in <a href="http://psd.tutsplus.com/tutorials/interface-tutorials/photoshop-paper-texture-from-scratch-then-create-a-grungy-web-design-with-it/">This tutorial</a> over at PSDTuts (scroll down to step 34). If you&#8217;re feeling lazy, you can download the custom shape <a class href="http://twopartsglue.deviantart.com/art/Tab-Custom-Shape-141211991">here.</a><br />
To make the active tab, bring one of the tab layers to the top and change the colour. </p>
<div class="post_img"><a href="http://www.codealamode.net/wp-content/uploads/2009/12/1.jpg"><img src="http://www.codealamode.net/wp-content/uploads/2009/12/1.jpg" alt="" title="1" width="597" height="270" class="aligncenter size-full wp-image-676" /></a></div>
<p>Now we&#8217;re going to have to make a mess of things so we can slice it up properly. As you know, the sliding doors technique requires one small image from one side of the tab, and an extra-long image from the other side. We&#8217;re going to do this slightly differently, because we need our tabs to overlap. </p>
<div class="post_img"><a href="http://www.codealamode.net/wp-content/uploads/2009/12/2.jpg"><img src="http://www.codealamode.net/wp-content/uploads/2009/12/2.jpg" alt="" title="2" width="491" height="223" class="aligncenter size-full wp-image-679" /></a></div>
<p>We&#8217;re going to isolate two tabs and extend one of them to be larger than we need. Next, select the Slice Tool (C) and make one slice of the area where the two tabs overlap, and another of the remainder of the left tab, excluding the edge detail. Then just turn off the background and save for the web as transparent PNGs.  </p>
<div class="post_img"><a href="http://www.codealamode.net/wp-content/uploads/2009/12/3.jpg"><img src="http://www.codealamode.net/wp-content/uploads/2009/12/3.jpg" alt="" title="3" width="600" height="260" class="aligncenter size-full wp-image-680" /></a></div>
<p>Next, we do the same thing with the active tab and one inactive tab, but this time we need the whole of the active tab, including the edge detail, and the overlap with the tab to its left. Make sure that the right slice is the same size as the smaller slice we made in the previous step. It may be easier to do both steps at once.</p>
<p>Next, hide the background and save the right-hand slice as a transparent PNG, then show the background, and save the left-hand slice as a JPEG.
</p>
<div class="post_img"><a href="http://www.codealamode.net/wp-content/uploads/2009/12/4.jpg"><img src="http://www.codealamode.net/wp-content/uploads/2009/12/4.jpg" alt="" title="4" width="600" height="255" class="aligncenter size-full wp-image-681" /></a></div>
<p>Next we need some images of non-overlapping tabs to use for the first and last tabs in our navigation menu. We need these for both the active and inactive states. Save these all as transparent PNGs. </p>
<div class="post_img"><a href="http://www.codealamode.net/wp-content/uploads/2009/12/5.jpg"><img src="http://www.codealamode.net/wp-content/uploads/2009/12/5.jpg" alt="" title="5" width="600" height="196" class="aligncenter size-full wp-image-682" /></a></div>
<p>So we should have the following images, give them all descriptive names.
</p>
<div class="post_img"><a href="http://www.codealamode.net/wp-content/uploads/2009/12/6.jpg"><img src="http://www.codealamode.net/wp-content/uploads/2009/12/6.jpg" alt="" title="6" width="601" height="276" class="aligncenter size-full wp-image-683" /></a></div>
<h3>Step 2 &#8211; XHTML</h3>
<p>Start with just a simple unordered list within a containing div.
</p>
<pre class="brush: xml; title: ; notranslate">
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;
&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; xml:lang=&quot;en&quot; lang=&quot;en&quot;&gt;
&lt;head&gt;
	&lt;title&gt;Overlapping tabs&lt;/title&gt;
	&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot; /&gt;
	&lt;link href=&quot;style.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot; media=&quot;screen&quot; /&gt;
&lt;/head&gt;
&lt;body&gt;
	&lt;div class=&quot;container&quot;&gt;
		&lt;ul&gt;
			&lt;li&gt;&lt;a href=&quot;#&quot;&gt;Home&lt;/a&gt;&lt;/li&gt;
			&lt;li&gt;&lt;a href=&quot;#&quot;&gt;About&lt;/a&gt;&lt;/li&gt;
			&lt;li&gt;&lt;a href=&quot;#&quot;&gt;Portfolio&lt;/a&gt;&lt;/li&gt;
			&lt;li&gt;&lt;a href=&quot;#&quot;&gt;Blog&lt;/a&gt;&lt;/li&gt;
			&lt;li&gt;&lt;a href=&quot;#&quot;&gt;Contact&lt;/a&gt;&lt;/li&gt;
		&lt;/ul&gt;
	&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<h3>Step 3 &#8211; CSS</h3>
<p>In the css file, add a simple reset to simplify things, add a background colour to the body, and a width to the containing div. We&#8217;re also going to get rid of the list-style, and add a margin at the top so we can better see what We&#8217;re doing.
</p>
<pre class="brush: css; title: ; notranslate">
body, div, h1, h2, h3, h4, h5, h6, p, ul, ol, dl, dt, dd, img, form, fieldset, blockquote {
    margin:0px; padding:0px; border:0px;
}

body {background: #333333;}

.container {width: 960px; margin: 0 auto;}

ul {margin-top: 50px; list-style: none;}
</pre>
<p>Next, float the list items into a horizontal line. </p>
<pre class="brush: css; title: ; notranslate">
ul li {float: left;}
</pre>
<p>Now we can add in our background images. It&#8217;s going to look really bad at first, but bear with me, we&#8217;ll fix it right away. Lets also add some font styling while we&#8217;re at it.
</p>
<pre class="brush: css; title: ; notranslate">
ul li {
	float: left;
	background: url(images/inactive_right.png) no-repeat right;
}

ul li a {
	background: url(images/inactive_left.png) no-repeat left;
	font-size: 20px;
	color: #716c62;
	font-family: &quot;Lucida Grande&quot;, helvetica, sans-serif;
	text-decoration: none;
}
</pre>
<p>And we&#8217;ll have something like this:</p>
<div class="post_img"><a href="http://www.codealamode.net/wp-content/uploads/2009/12/7.jpg"><img src="http://www.codealamode.net/wp-content/uploads/2009/12/7.jpg" alt="" title="7" width="600" height="326" class="aligncenter size-full wp-image-684" /></a></div>
<p>Now, we&#8217;re going to add some padding to fix up our tabs. Lets start with the list-items. I&#8217;m going to add 12px of padding to the top and bottom, but add however much you need to get the full height of your tabs. Next, add some padding to the right. The amount should be about the width of the inactive_right image. </p>
<pre class="brush: css; title: ; notranslate">
ul li {
	float: left;
	background: url(images/inactive_right.png) no-repeat right;
	padding: 12px 59px 12px 0;
}
</pre>
<div class="post_img"><a href="http://www.codealamode.net/wp-content/uploads/2009/12/8.jpg"><img src="http://www.codealamode.net/wp-content/uploads/2009/12/8.jpg" alt="" title="8" width="600" height="279" class="aligncenter size-full wp-image-685" /></a></div>
<p>Next, add the same bottom and top padding to the anchor tag items.</p>
<pre class="brush: css; title: ; notranslate">
ul li a {
	background: url(images/inactive_left.png) no-repeat left;
	font-size: 20px;
	color: #716c62;
	font-family: &quot;Lucida Grande&quot;, helvetica, sans-serif;
	text-decoration: none;
	padding: 12px 0 12px 0;
}
</pre>
<p>There, that looks much better:</p>
<div class="post_img"><a href="http://www.codealamode.net/wp-content/uploads/2009/12/9.jpg"><img src="http://www.codealamode.net/wp-content/uploads/2009/12/9.jpg" alt="" title="9" width="600" height="216" class="aligncenter size-full wp-image-686" /></a></div>
<p>Depending on the design of your tabs, you may want to add a bit of padding to the left and right to make things look right. </p>
<p>The next step is to add the alternative images to the first and last links. I&#8217;d like to be able to use the first- and last-child pseudo-classes, but our favourite 12% of web users (IE6 users) wouldn&#8217;t see them. So, lets just add classes to the first and last items in our markup.
</p>
<pre class="brush: xml; title: ; notranslate">
&lt;ul&gt;
	&lt;li class=&quot;first&quot;&gt;&lt;a href=&quot;#&quot;&gt;Home&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;#&quot;&gt;About&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;#&quot;&gt;Portfolio&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;#&quot;&gt;Blog&lt;/a&gt;&lt;/li&gt;
	&lt;li class=&quot;last&quot;&gt;&lt;a href=&quot;#&quot;&gt;Contact&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</pre>
<p>And add our alternate background images. We&#8217;re also going to have to adjust the padding on the first-item tab.
</p>
<pre class="brush: css; title: ; notranslate">
ul li.first a {background:url(images/first_inactive_left.png) no-repeat left; padding-left: 50px; }

ul li.last {background: url(images/last_inactive_right.png) no-repeat right;}
</pre>
<div class="post_img"><a href="http://www.codealamode.net/wp-content/uploads/2009/12/10.jpg"><img src="http://www.codealamode.net/wp-content/uploads/2009/12/10.jpg" alt="" title="10" width="600" height="251" class="aligncenter size-full wp-image-687" /></a></div>
<p>Next we need to add the active states. Since we&#8217;re working with a static web page, and our links don&#8217;t go anywhere, we&#8217;re going to have our active tabs display on hover. Obviously, if you&#8217;re using this for your website, you would instead add the active styles to the active tab of each page.
</p>
<pre class="brush: css; title: ; notranslate">
ul li:hover {background:url(images/active_right.png) no-repeat right; }

ul li:hover a {background:url(images/active_left.png) no-repeat left; }
</pre>
<p>To create the effect that the active tab is above the inactive tabs, we need to add a negative margin to the left-hand image so that it overlaps the tab to its left, and then add back the same amount in padding. This part is a bit fiddly, you may have to experiment with the size of the margin. In my case, the margin is 3px wider than the 59px images that make up the right sides of the tabs.
</p>
<pre class="brush: css; title: ; notranslate">
ul li:hover a {background:url(images/active_left.png) no-repeat left; margin-left: -62px; padding-left: 62px; }
</pre>
<p>Next we just need to add the appropriate background images for the active states of the first and last tabs. We also need to get rid of the negative margin on the first tab.
</p>
<pre class="brush: css; title: ; notranslate">
ul li.last:hover {background:url(images/last_active_right.png) no-repeat right; }

ul li.first:hover a {background: url(images/first_active_left.png) no-repeat left; margin-left: 0;}
</pre>
<p>And there we have it, some overlapping, interactive tabs! </p>
<div class="post_img"><a href="http://www.codealamode.net/wp-content/uploads/2009/12/111.jpg"><img src="http://www.codealamode.net/wp-content/uploads/2009/12/111.jpg" alt="" title="11" width="600" height="195" class="aligncenter size-full wp-image-688" /></a></div>
<p><a href="https://www.e-junkie.com/ecom/gb.php?ii=680773&#038;c=ib&#038;aff=139636&#038;cl=12635" target="ejejcsingle"><img src="http://rockable.s3.amazonaws.com/Affiliates/photoshop_html_728x90.gif" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.codealamode.net/overlapping-tabs/feed</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
	</channel>
</rss>

