<?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>Devin R. Olsen Web Developer &#187; CSS Tutorials</title>
	<atom:link href="http://www.devinrolsen.com/category/css-tutorials/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.devinrolsen.com</link>
	<description>From Developer to Developer Information and Sharing</description>
	<lastBuildDate>Fri, 20 Aug 2010 05:08:59 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Pure CSS Menu With Infinite Sub Menus Tutorial</title>
		<link>http://www.devinrolsen.com/pure-css-menu-with-infinite-sub-menus-tutorial/</link>
		<comments>http://www.devinrolsen.com/pure-css-menu-with-infinite-sub-menus-tutorial/#comments</comments>
		<pubDate>Sat, 26 Jun 2010 23:14:39 +0000</pubDate>
		<dc:creator>Devin R. Olsen</dc:creator>
				<category><![CDATA[CSS Tutorials]]></category>
		<category><![CDATA[CSS Infinite Menus]]></category>
		<category><![CDATA[CSS Menu]]></category>
		<category><![CDATA[CSS Menu Tutorial]]></category>
		<category><![CDATA[Infinite Menus]]></category>
		<category><![CDATA[Infinite Sub Menus]]></category>
		<category><![CDATA[pure css menu]]></category>
		<category><![CDATA[Pure CSS Menus]]></category>
		<category><![CDATA[Sub Menus]]></category>
		<guid isPermaLink="false">http://www.devinrolsen.com/?p=774</guid>
		<description><![CDATA[Today we are going to cover how to build a pure CSS menu with infinite sub menus; an area of CSS that is seldom talked about, poorly written or misconceived. This pure CSS menu with infinite sub menus technique makes use of CSS2 selectors so it will not work in IE6 and below without help [...]]]></description>
			<content:encoded><![CDATA[<p>Today we are going to cover how to build a pure CSS menu with infinite sub menus; an area of CSS that is seldom talked about, poorly written or misconceived. This pure CSS menu with infinite sub menus technique makes use of CSS2 selectors so it will not work in IE6 and below without help from JavaScript. With that said, this pure CSS menu with infinite sub menus technique will work in:</p>
<ul>
<li>IE7, IE8,</li>
<li>FireFox,</li>
<li>Safari</li>
<li>Opera</li>
</ul>
<p>This pure CSS menu with infinite sub menus technique  only uses 10 CSS rules making it EXTREMELY light weight. This technique also overcomes some funky IE bugs such as Ghost Hovers and Z-Indexing issues via pure CSS.</p>
<h3><a href="http://www.devinrolsen.com/wp-content/themes/typebased/demos/css/infinite-sub-menu" target="_blank"><strong>[CLICK HERE TO SEE DEMO OF TUTORIAL]</strong></a></h3>
<p>Lets Begin shall we? Start by creating a new html document and use the following code to make this lesson go smoother for everyone.</p>
<pre>
xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
&lt;title&gt;Devin R. Olsen - Pure CSS Menu &amp;amp;amp;amp;amp;amp;amp;amp;amp; Infinite Sub Menus&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;/body&gt;
</pre>
<p>In the body of our newly created document lets setup an unordered list with some list items like so.</p>
<pre>
&lt;ul&gt;
&lt;li&gt;Menu 1&lt;/li&gt;
&lt;li&gt;Menu 2&lt;/li&gt;
&lt;li&gt;Menu 3&lt;/li&gt;
&lt;li&gt;Menu 4&lt;/li&gt;
&lt;/ul&gt;</pre>
<p>We start by giving our top-level un-ordered element an id of &#8220;nav&#8221; so we have some sort of unique identifier to reference to with our CSS. Next lets copy the whole thing and nest a second list into any of our first level list items and change its ID to a CLASS like so:</p>
<pre>
&lt;ul&gt;
&lt;li&gt;Menu 1
&lt;ul class="nav"&gt;
&lt;li&gt;Menu 1&lt;/li&gt;
&lt;li&gt;Menu 2&lt;/li&gt;
&lt;li&gt;Menu 3&lt;/li&gt;
&lt;li&gt;Menu 4&lt;/li&gt;
&lt;ul&gt;
&lt;/li&gt;
&lt;li&gt;Menu 2&lt;/li&gt;
&lt;li&gt;Menu 3&lt;/li&gt;
&lt;li&gt;Menu 4&lt;/li&gt;
&lt;/ul&gt;
</pre>
<p>That&#8217;s it for the HTML portion, just note that top-level list menu gets an id called &#8220;nav&#8221; while all nested sub menus get a class called &#8220;nav&#8221;. You can continue to nest as many menus you like in the same manner from here on out to meet your css menu desires.</p>
<p>Lets move onto the CSS portion. In the header of our document lets create some style tags that will house all our menus CSS like so:</p>
<pre>
&lt;style type="text/css"&gt;
&lt;/style&gt;
</pre>
<p>We will start with our most important reset and structure styles for our menu. First lets point to our #nav, .nav and #nav .nav li elements and reset their margin&#8217;s and padding&#8217;s to zero like so:</p>
<pre>#nav, .nav, #nav .nav li { margin:0px; padding:0px; }</pre>
<p>This is done to remove any default browser margin&#8217;s and padding&#8217;s automatically applied to these element types. Next lets point directly to our first level list items and give them some structure / style like so:</p>
<pre>#nav, .nav, #nav .nav li { margin:0px; padding:0px; }
#nav li {float:left; display:inline; cursor:pointer; list-style:none; padding:10px "&gt;0px 10px 0px 10px; border:1px #000 solid; position:relative; }</pre>
<p>Our menu will be of horizontal so we set the first level list items to a float of left and a display of inline. We also give the list items a list-style of none to remove browser default bullet points next to each list item. Last we give our list items a position of relative in order to prevent any child elements who may be positioned absolute from breaking out of the flow of design. The rest of the styles are of visual preference and up to the developer to change however they desire.</p>
<p>Next we must have some way to identify our top-level sub menus to from all the rest. We do this to give visual guidance on how our first level sub menu  is displayed against our top-level menu. To do this we must include a new class to our first level sub menus ONLY, called &#8220;first&#8221; like so:</p>
<pre>
&lt;ul&gt;
&lt;li&gt;Menu 1
&lt;ul class="nav first"&gt;
&lt;li&gt;Menu 1&lt;/li&gt;
&lt;li&gt;Menu 2&lt;/li&gt;
&lt;li&gt;Menu 3&lt;/li&gt;
&lt;li&gt;Menu 4&lt;/li&gt;
&lt;ul&gt;
&lt;/li&gt;
&lt;li&gt;Menu 2&lt;/li&gt;
&lt;li&gt;Menu 3&lt;/li&gt;
&lt;li&gt;Menu 4&lt;/li&gt;
&lt;/ul&gt;
</pre>
<p>Again this is only for our &#8220;FIRST LEVEL SUB MENUS&#8221; that we apply this new &#8220;first&#8221; class to and not any of the rest of our further nested menus. Next lets point to these first level sub menus and set some structure rules via CSS like so:</p>
<pre>#nav, .nav, #nav .nav li { margin:0px; padding:0px; }
#nav li {float:left; display:inline; cursor:pointer; list-style:none; padding:10px "&gt;0px 10px 0px 10px; border:1px #000 solid; position:relative; }
#nav li ul.first {left:-1px; top:100%;}</pre>
<p>We give our first level sub menu&#8217;s a top percentage of 100 to make it fall directly below our top-level menu. Because our list items have a 1px border we give our first level menu items a left style that is negative 1 to assure our first sub menu&#8217;s fall completely to the left when being displayed.</p>
<p>Next lets start giving our elements some style rules. First we will point to all our list items and anchor links that any list item may carry like so:</p>
<pre>li, li a {color:#000;}</pre>
<p>Here we have set our list items and anchor tags any list item may carry to have a text color of black or rather #000. Next we will point to all our sub menu list items ONLY and give some structure and styles like so:</p>
<pre>li, li a {color:#000;}
#nav .nav li { width:100%; text-indent:10px; line-height:30px; margin-right:10px; border-top:1px #000 solid; border-bottom:1px #000 solid; border-left:none; border-right:none; background:#fff;}</pre>
<p>Note how we first pass through the #nav element before calling .nav li vs. just stating .nav li? This is important as its a fix to helps us over come some spacing issues due to our list item borders. The first style we give here is a width of 100% to insure our list items will completely span across its parents set width. The rest of the styles are up to the developer to change to however they like.</p>
<p>Next lets give some structure to our list item&#8217;s anchor elements like so:</p>
<pre>li, li a {color:#000;}
#nav .nav li { width:100%; text-indent:10px; line-height:30px; margin-right:10px; border-top:1px #000 solid; border-bottom:1px #000 solid; border-left:none; border-right:none; background:#fff;}
#nav li a {display:block; width:inherit; height:inherit;}</pre>
<p>We first point to all our list items and then search for all anchor tags, then we give each anchor tag a display of block and an inherited width and height from its own parent element.</p>
<p>Next lets begin adding our menus behavior styles such has hover and when to display a sub menu and when not to display a sub menu. This part is really where the magic happens and our ability to have a pure CSS menu with infinite sub menus come into play.</p>
<p>First we need to give our sub menus a rule to hide them self&#8217;s from view until told otherwise like so:</p>
<pre>ul.nav { display:none; }</pre>
<p>We add an extra measure of security here when dealing with the display none style by stating &#8220;ONLY un-ordered list elements who have a class of &#8220;nav&#8221; must by default be a display of none&#8221;.</p>
<p>Next we will set our behavior color styles for list items and list item anchor tags like so:</p>
<pre>ul.nav { display:none; }
#nav li:hover &gt; a, #nav li:hover { color:#fff; background:#000; }</pre>
<p>We first point to all our list items that are under a hover state, as well as all list item&#8217;s anchor tags while the list item is under a hover state. Then we set a text color of white or rather #fff and a background of black or rather #000. These styles are for the developer to change to their desired look and feel.</p>
<p>Next we must create a rule to display our sub menus when its parent list item is under a hovered state like so:</p>
<pre>ul.nav { display:none; }
#nav li:hover &gt; a, #nav li:hover { color:#fff; background:#000; }
li:hover &gt; .nav { display:block; }</pre>
<p>Here we are stating that all list items that are under a state of hovered who have a child element with the class of .nav (our sub menu) must be displayed. By using the CSS child selector (&gt;) we are also stating that only the first proceeding child sub menu must be displayed while all the rest remain hidden.</p>
<p>Next lets talk about how we fix yet another IE bug. This one is called the &#8220;IE:Hover Ghost Bug&#8221; and in its basics it leaves deeply nested sub menus in a state of constant display after being hovered. To fix this bug we simply look at our last style as a igniting point. By giving style and structure to our sub menus when told to be displayed, vs. having a constant rule that is always giving style and structure to our element at all times, we squash the IE bug. So we add the following styles to our last rule like so:</p>
<pre>ul.nav { display:none; }
#nav li:hover &gt; a, #nav li:hover { color:#fff; background:#000; }
li:hover &gt; .nav { display:block; position:absolute; width:200px; top:-2px; left:50%; z-index:1000; border:1px #000 solid;}</pre>
<p>The position absolute is crucial to allowing our sub menus to be positioned relatively to its parents location on the page. We also set a pre-defined width to our sub menus of 200px as well as offset the menu by top -2px (due to borders width) and by left 50% of its parent element. Last and most important style we give to our sub menus is a z-index of 1000 to make sure everything layers or rather sorts correctly.</p>
<p>Last thing we need to do is squash yet another IE bug that deals width z-index and properly sorting elements or rather layers. To do this we simple state that all sub menu&#8217;s parent elements (list items) must have a higher z-index value than the sub menu elements like so:</p>
<pre>ul.nav { display:none; }
#nav li:hover &gt; a, #nav li:hover { color:#fff; background:#000; }
li:hover &gt; .nav { display:block; position:absolute; width:200px; top:-2px; left:50%; z-index:1000; border:1px #000 solid;}
li:hover { position:relative; z-index:2000; }</pre>
<p>Pssst.. That&#8217;s it folks, that&#8217;s all the CSS you need to have a fully compleated Pure CSS Menu with infinite amounts of sub menus, enjoy!</p>
<p>Completed CSS Code:</p>
<pre>
#nav, .nav, #nav .nav li { margin:0px; padding:0px; }
#nav li {float:left; display:inline; cursor:pointer; list-style:none; padding:0px 10px 0px 10px; border:1px #000 solid; position:relative;}
#nav li ul.first {left:-1px; top:100%;}
li, li a {color:#000; text-decoration:none;}
#nav .nav li { width:100%; text-indent:10px; line-height:30px; margin-right:10px; border-top:1px #000 solid; border-bottom:1px #000 solid;
border-left:none; border-right:none; background:#fff;}
#nav li a {display:block; width:inherit; height:inherit;}
ul.nav { display:none; }
#nav li:hover &gt; a, #nav li:hover { color:#fff; background:#000; }
li:hover &gt; .nav { display:block; position:absolute; width:200px; top:-2px; left:50%; z-index:1000; border:1px #000 solid; }
li:hover { position:relative; z-index:2000; }
</pre>
<p>Thanks Everyone.<br />
Devin R. Olsen</p>
]]></content:encoded>
			<wfw:commentRss>http://www.devinrolsen.com/pure-css-menu-with-infinite-sub-menus-tutorial/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>How to Build jQuery Lava Lamp Menu Tabs</title>
		<link>http://www.devinrolsen.com/build-jquery-lava-lamp-menu-tabs/</link>
		<comments>http://www.devinrolsen.com/build-jquery-lava-lamp-menu-tabs/#comments</comments>
		<pubDate>Fri, 25 Dec 2009 09:05:00 +0000</pubDate>
		<dc:creator>Devin R. Olsen</dc:creator>
				<category><![CDATA[CSS Tutorials]]></category>
		<category><![CDATA[JavaScript Tutorials]]></category>
		<category><![CDATA[css menu tabs]]></category>
		<category><![CDATA[javascript menu tabs]]></category>
		<category><![CDATA[jquery lava lamp]]></category>
		<category><![CDATA[jquery menu tabs]]></category>
		<category><![CDATA[lava lamp menu]]></category>
		<category><![CDATA[lava lamp menu tabs]]></category>
		<guid isPermaLink="false">http://www.devinrolsen.com/?p=567</guid>
		<description><![CDATA[Here I am going to show you how to build "Lava Lam"p menu tabs. We will be using CSS / jQuery and a single image to maintain a 100% stretchy rounded corners menu tab or lava bubble if you will. This version of the Lava Lamp menu tabs works in IE6+ and all other browsers! ]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><img class="alignnone size-full wp-image-569" title="equation" src="http://www.devinrolsen.com/wp-content/uploads/2009/12/equation1.gif" alt="equation" width="372" height="89" /></p>
<h3><a href="http://www.devinrolsen.com/wp-content/themes/typebased/demos/jquery/lavalamp" title="Lava Lamp Tutorial Example Demo">Click Here to See This Tutorial&#8217;s Example Demo</a></h3>
<p><object width="440" height="345"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=8502892&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><param name="wmode" value="transparent" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=8502892&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" wmode="transparent" allowscriptaccess="always" width="440" height="345"></embed></object>
<p><a href="http://vimeo.com/8502892">How to Build jQuery Lava Lamp Menu Tabs</a> from <a href="http://vimeo.com/user2898580">Devin R. Olsen</a> on <a href="http://vimeo.com">Vimeo</a>.</p>
<p>This effect is called &#8220;animated rounded menu tabs&#8221;. It&#8217;s a neat little effect that will work in all browsers including IE6+. somethings to note is that this technique uses a single image for its four corners and is stretchy in both width and height!</p>
<p>We are also using the jQuery JS lib to ensure our JS works across all browsers but also to cut  down on the amount of JS we uses to make this great effect. Here is the link I use in the video tutorial to use the jQuery lib from Google&#8217;s online repository.</p>
<pre>http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js</pre>
<p>Here is the full source if you want to just get down to studying the code.</p>
<pre>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
&lt;title&gt;Devin R. Olsen - Lava Lamp Menu Tabs&lt;/title&gt;
&lt;style type="text/css"&gt;
#nav {width:500px;  background:#333; margin:0px; padding:0px 0px 0px 20px; color:#fff; position:relative;}
#nav li {float:left; display:inline; list-style:none; line-height:35px; position:relative; z-index:3;}
#nav li a { padding:0px 10px 0px; cursor:pointer; font-size:12px; display:inline; color:#fff;}
#nav li.rounder { position:absolute; left:0px; top:0px; margin:0px; padding:0px; display:none; z-index:2;}
#nav li.rounder img {position:absolute;}
.cornersWrap {position:relative; height:25px; width:auto; margin-top:5px; background:#fff;}
#nav, #nav li, #nav li a, #nav li.rounder {height:35px;}
#tl,#tr,#bl,#br {position:absolute; width:8px; height:8px; overflow:hidden;}
#tr,#tl {top:0px;}
#br,#bl {bottom:0px;}
#tr,#br {right:0px;}
#tl,#bl {left:0px;}
#tr img,#br img {left:-8px;}
#bl img,#br img {top:-8px;}
&lt;/style&gt;
&lt;script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript"&gt;
$(document).ready(function(){
	$("#nav li a").mouseover(function(){
		$("#nav li a").each(function(count){
			$(this).css({color:"#fff"});
		});
		$(this).css({color:"#000"});
		var offL =  $(this).offset().left - $("#nav").offset().left;
		var offW = $(this).width() + parseInt($(this).css("paddingLeft")) * 2;
		$("li.rounder").stop().animate({left:offL+"px", width:offW+"px"},295,function(){
			//IE6 1px Fix
			var trOff = $("#tr").offset().left + parseInt($("#tr").css("width"));
			var wrapWOff = $(".rounder").offset().left + parseInt($(".rounder").css("width"));
			var brOff = $("#br").offset().top + parseInt($("#br").css("height"));
			var wrapHOff = $(".cornersWrap").offset().top + parseInt($(".cornersWrap").css("height"));
			if(wrapWOff &gt; trOff){
				$("#tr,#br").attr("class","rFix");
			}
			$(".rFix").css({right:"-1px"});
			if(wrapHOff &gt; brOff){
				$("#br,#bl").attr("class","bFix");
			}
			$(".bFix").css({bottom:"-1px"});
		});
	});
});
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
	&lt;div&gt;
    	&lt;ul id="nav"&gt;
        	&lt;li&gt;&lt;a href="#"&gt;Short&lt;/a&gt;&lt;/li&gt;
            &lt;li&gt;&lt;a href="#"&gt;Longer&lt;/a&gt;&lt;/li&gt;
            &lt;li&gt;&lt;a href="#"&gt;Kinda Long&lt;/a&gt;&lt;/li&gt;
            &lt;li&gt;&lt;a href="#"&gt;Kinda Longer&lt;/a&gt;&lt;/li&gt;
            &lt;li&gt;&lt;a href="#"&gt;Really Longer&lt;/a&gt;&lt;/li&gt;
            &lt;li&gt;&lt;a href="#"&gt;A Really Lot Longer&lt;/a&gt;&lt;/li&gt;
            &lt;li class="rounder"&gt;
            	&lt;div class="cornersWrap"&gt;
                    &lt;div id="tl"&gt;&lt;img src="http://www.devinrolsen.com/wp-content/themes/typebased/images/rounder.gif" /&gt;&lt;/div&gt;
                    &lt;div id="tr"&gt;&lt;img src="http://www.devinrolsen.com/wp-content/themes/typebased/images/rounder.gif" /&gt;&lt;/div&gt;
                    &lt;div id="bl"&gt;&lt;img src="http://www.devinrolsen.com/wp-content/themes/typebased/images/rounder.gif" /&gt;&lt;/div&gt;
                    &lt;div id="br"&gt;&lt;img src="http://www.devinrolsen.com/wp-content/themes/typebased/images/rounder.gif" /&gt;&lt;/div&gt;
                &lt;/div&gt;
            &lt;/li&gt;
        &lt;/ul&gt;
    &lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.devinrolsen.com/build-jquery-lava-lamp-menu-tabs/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>IE6 Z-Index Sort Order Issue Fix</title>
		<link>http://www.devinrolsen.com/ie6-z-index-sort-bug-fix/</link>
		<comments>http://www.devinrolsen.com/ie6-z-index-sort-bug-fix/#comments</comments>
		<pubDate>Sat, 12 Dec 2009 03:15:33 +0000</pubDate>
		<dc:creator>Devin R. Olsen</dc:creator>
				<category><![CDATA[CSS Tutorials]]></category>
		<category><![CDATA[IE z-index bug]]></category>
		<category><![CDATA[IE6 bug]]></category>
		<category><![CDATA[IE6 z-index bug]]></category>
		<category><![CDATA[position absolute]]></category>
		<category><![CDATA[position z-index IE bug]]></category>
		<category><![CDATA[z-index order]]></category>
		<guid isPermaLink="false">http://www.devinrolsen.com/?p=498</guid>
		<description><![CDATA[Did you know that IE6 has an bug when it comes time to use the CSS z-index sorting style? Here I will show you how to over come this classic IE6 z-index sorting issue.]]></description>
			<content:encoded><![CDATA[<p>Today I wanted to share a little tip on how to avoid yet another IE bug. The z-index style helps developers use elements as layers. With the z-index style you are able to dictate the elements or layers stack, sort order, z order what ever you wanna call it.</p>
<p>IE6 has an issue with the z-index and being able to properly sort these layers correctly. As stated from <a href="http://www.quirksmode.org/bugreports/archives/2006/01/Explorer_z_index_bug.html">www.quirksmode.org</a>:</p>
<blockquote><p>&#8220;In Internet Explorer positioned elements generate a new stacking context, starting with a z-index value of 0. Therefore z-index doesn’t work correctly&#8221;</p></blockquote>
<p>So whats a person to do when they run into this z-index issue and IE6? Simple really its about identifying root elements to your document, here let me explain with some HTML and CSS.<br />
[sourcecode language='css']#boxWrap {width:200px; height:200px; border:1px #000 dashed; position:relative;}<br />
#layer1,#layer2{ width:150px; height:150px; }</p>
<p>#layer1 {<br />
left:375px;<br />
top:80px;<br />
background:#000;<br />
z-index:2;<br />
position:absolute;<br />
}</p>
<p>#layer2 {<br />
left:285px;<br />
top:-50px;<br />
border:1px #fff solid;<br />
background:#666;<br />
z-index:1;<br />
position:relative;<br />
}[/sourcecode]<br />
And the HTML:<br />
[sourcecode language='html']<body></p>
<div id="boxWrap">
<div id="layer1"></div>
</div>
<div id="layer2"></div>
<p></body>[/sourcecode]<br />
In the above HTML you will see that we have two elements at root level of the documents body. We have the &#8220;boxWrap1&#8243; and the &#8220;layer2&#8243; div elements. Both elements are positioned relative, however &#8220;boxWrap1&#8243; has a nested elements called &#8220;layer1&#8243;.</p>
<p>The div elements &#8220;layer1&#8243; is positioned absolute and has a z-index of 2. Both &#8220;layer1&#8243; and &#8220;layer2&#8243; make use of their left and top style rules to position themselves over each other. The &#8220;layer2&#8243; elements also has a z-index rule that is of 1. If &#8220;layer1&#8243; has a z-index of 2 and &#8220;layer2&#8243; has a z-index of 1, then in all browsers this is what you should see.</p>
<p><img class="size-full wp-image-501" title="ALLOTHERS" src="http://www.devinrolsen.com/wp-content/uploads/2009/12/ALLOTHERS.gif" alt="Position aboslute and Z-Index CSS Example" width="256" height="153" /></p>
<p>However in IE6 this is what you get!<br />
<a href="http://www.devinrolsen.com/wp-content/uploads/2009/12/IE6.gif"><img class="alignnone size-full wp-image-502" title="IE6" src="http://www.devinrolsen.com/wp-content/uploads/2009/12/IE6.gif" alt="IE6" width="256" height="153" /></a></p>
<p>This is the classic IE6 Z-Index bug right here for you at its most basic. So how do we fix this little issue? Simple really first look to the element who is positioned absolute and has the highest z-index, in our case its &#8220;layer1&#8243;.</p>
<p>Next you must locate the absolute ROOT parent of the element that is positioned absolute and has the highest z-index in our case its &#8220;boxWrap&#8221;.</p>
<p>Last but not least give your root parent element or rather &#8220;boxWrap&#8221; a z-index that is higher than your positioned absolute element &#8220;layer1&#8243;.</p>
<p>The objective was to make our z-index:2; element be sorted over our z-index:1; element so by going to our root element of the highest z-index element and giving it an even higher z-index:3; fixes this issue.</p>
<p>Note: You don&#8217;t have to give your root element and position styles just a simply higher z-index will fix the issue. Also note that the lower z-index element does not have to be root with documents body for this bug killer to work.</p>
<p>Enjoy,</p>
<p>Devin R. Olsen</p>
]]></content:encoded>
			<wfw:commentRss>http://www.devinrolsen.com/ie6-z-index-sort-bug-fix/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>CSS RUB Compressing and Organizing</title>
		<link>http://www.devinrolsen.com/css-rub-organization/</link>
		<comments>http://www.devinrolsen.com/css-rub-organization/#comments</comments>
		<pubDate>Mon, 14 Sep 2009 05:54:03 +0000</pubDate>
		<dc:creator>Devin R. Olsen</dc:creator>
				<category><![CDATA[CSS Tutorials]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[CSS Compressing]]></category>
		<category><![CDATA[CSS Organizing]]></category>
		<category><![CDATA[CSS RUB]]></category>
		<guid isPermaLink="false">http://devinrolsen.com/?p=415</guid>
		<description><![CDATA[I wanted to take some time and introduce to you a new technique I have come up with that helps me out in both CSS file size but also organization. This technique of mine has been dubbed RUB which stands for (Repeating Unique Behaviors).]]></description>
			<content:encoded><![CDATA[<p>Hi everyone today I wanted to take some time and introduce to you a new technique I have come up with that helps me out in both CSS file size but also organization. This technique of mine has been dubbed RUB which stands for (Repeating Unique Behaviors). CSS RUB is taking a style sheet and breaking it down into logical categories that reveals common or rather repeated styles much faster while also helping organize. It&#8217;s also debated if its give a proper hierarchy over your styles to cut down on style rule conflicts.</p>
<p>So to begin lets take a look at a sample demo site:</p>
<pre>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
&lt;title&gt;RUB Demonstration Site&lt;/title&gt;
&lt;style type="text/css"&gt;
body {margin:0px; padding:0px; text-align:center;}
#wrapper {width:750px; margin-left:auto; margin-right:auto; text-align:left;}
#header {float:left; width:100%; border-bottom:1px #000 solid;}
#header h1 {margin:0px; padding:0px;}
#nav {margin:0px; padding:0px; float:left; display:block; width:100%; height:30px; font-size:12px;}
#nav li {float:left; display:block; height:30px; position:relative; list-style:none; list-style-type:none;  padding:0px 10px 0px 10px;}
#nav li a {display:block; float:left; height:30px; color:#000; text-align:center; padding:0px 10px 0px 10px; line-height:30px; text-decoration:none;}
#nav li a:hover {background:#000; color:#fff; text-decoration:underline;}
#nav li ul {display:none;}
#nav li:hover ul {display:block; left:0px; margin:0px; padding:0px; border:1px #000 solid; top:28px; position:absolute; width:130px;}
#nav li li { margin:0px; padding:0px;  background:#000; width:100%; float:left;}
#nav li li a {margin:0px; padding:0px; color:#fff; text-align:left; text-indent:15px; display:block; height:30px; width:100%;}
#nav li li a:hover {background:#fff; color:#000;}
#middle {float:left; width:100%;}
#leftCol {width:250px; float:left; padding-top:10px;}
#leftCol h2 {margin:0px; padding:0px; text-indent:10px;}
#leftCol p {margin:0px; padding:30px; display:block;}
#rightCol {width:499px; float:left;  padding-top:10px; border-left:1px #000 solid;}
#rightCol h2 {margin:0px; padding:0px; text-indent:10px;}
#rightCol p {margin:0px; padding:30px; display:block;}
#footer {float:left; width:100%;}
#footer h3 {display:block; border-top:1px #000 solid; width:90%; margin-left:5%;}
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div id="wrapper"&gt;
    &lt;div id="header"&gt;
    	&lt;h1&gt;This is our site&lt;/h1&gt;
        &lt;ul id="nav"&gt;
        	&lt;li&gt;&lt;a href="#"&gt;Home&lt;/a&gt;&lt;/li&gt;
            &lt;li&gt;&lt;a href="#"&gt;About&lt;/a&gt;&lt;/li&gt;
            &lt;li&gt;&lt;a href="#"&gt;Contact&lt;/a&gt;
            	&lt;ul&gt;
                	&lt;li&gt;&lt;a href="#"&gt;Contact 1&lt;/a&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;a href="#"&gt;Contact 2&lt;/a&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;a href="#"&gt;Contact 3&lt;/a&gt;&lt;/li&gt;
                &lt;/ul&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;a href="#"&gt;Help&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
    &lt;/div&gt;
    &lt;div id="middle"&gt;
        &lt;div id="leftCol"&gt;
        	&lt;h2&gt;Left Column&lt;/h2&gt;
            &lt;p&gt;
Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero.
			&lt;/p&gt;
        	&lt;h2&gt;Left Column&lt;/h2&gt;
            &lt;p&gt;
Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero.
			&lt;/p&gt;
        &lt;/div&gt;
        &lt;div id="rightCol"&gt;
        	&lt;h2&gt;Right Column&lt;/h2&gt;
            &lt;p&gt;
Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
            &lt;/p&gt;
        	&lt;h2&gt;Right Column&lt;/h2&gt;
            &lt;p&gt;
Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
            &lt;/p&gt;
        &lt;/div&gt;
    &lt;/div&gt;
    &lt;div id="footer"&gt;
    	&lt;h3&gt;This is our footer&lt;/h3&gt;
    &lt;/div&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<p>Now lets take a look at our demo site:</p>
<p><a href="http://devinrolsen.com/wp-content/uploads/2009/09/rubFig0.gif"><img class="alignnone size-full wp-image-416" title="rubFig0" src="http://devinrolsen.com/wp-content/uploads/2009/09/rubFig0.gif" alt="rubFig0" width="451" height="330" /></a></p>
<p>We have a header, middle content area and footer. Our header has a navigation menu with sub menu and some behaviors. Our middle content areas have a left and right column with header tags and paragraph tags.</p>
<p>So lets take a look at the CSS that makes this simple layout.</p>
<pre>body {margin:0px; padding:0px; text-align:center;}
#wrapper {width:750px; margin-left:auto; margin-right:auto; text-align:left;}
#header {float:left; width:100%; border-bottom:1px #000 solid;}
#header h1 {margin:0px; padding:0px;}
#nav {margin:0px; padding:0px; float:left; display:block; width:100%; height:30px; font-size:12px;}
#nav li {float:left; display:block; height:30px; position:relative; list-style:none; list-style-type:none;  padding:0px 10px 0px 10px;}
#nav li a {display:block; float:left; height:30px; color:#000; text-align:center; padding:0px 10px 0px 10px; line-height:30px; text-decoration:none;}
#nav li a:hover {background:#000; color:#fff; text-decoration:underline;}
#nav li ul {display:none;}
#nav li:hover ul {display:block; left:0px; margin:0px; padding:0px; border:1px #000 solid; top:28px; position:absolute; width:130px;}
#nav li li { margin:0px; padding:0px;  background:#000; width:100%; float:left;}
#nav li li a {margin:0px; padding:0px; color:#fff; text-align:left; text-indent:15px; display:block; height:30px; width:100%;}
#nav li li a:hover {background:#fff; color:#000;}
#middle {float:left; width:100%;}
#leftCol {width:250px; float:left; padding-top:10px;}
#leftCol h2 {margin:0px; padding:0px; text-indent:10px;}
#leftCol p {margin:0px; padding:30px; display:block;}
#rightCol {width:499px; float:left;  padding-top:10px; border-left:1px #000 solid;}
#rightCol h2 {margin:0px; padding:0px; text-indent:10px;}
#rightCol p {margin:0px; padding:30px; display:block;}
#footer {float:left; width:100%;}
#footer h3 {display:block; border-top:1px #000 solid; width:90%; margin-left:5%;}</pre>
<p>Lots of times when developing a web site or at least a layout you first and only concerns are to basically get the structure and look and feel in place and making sure everything is cross browser friendly. But lots of times this hasty CSS coding leaves us with repeated style that could be summed up into shorter rules.</p>
<p>So a lot of our time is spent cleaning up our design even though we should be been doing it right in the first place. So whats a person to do to even being to tackle a CSS clean up? Simple this is where the RUB methos works its magic. Lets create three area in our style sheet:</p>
<pre>/*Repeating*/
/*Unique*/
/*Behavior*/</pre>
<p>With these three areas defined we can begin to think taking our CSS mess and categorizing our styles into one of the three areas. Lets talk about what would calcify a style to belong to any one of these three areas.</p>
<h2>Repeating</h2>
<p>Repeating is for styles that are made to cascade over more than one element, but is not limited to just classes. h3{style}, #rightCol h3 {} or even .cols would all be repeating styles and would be listed here.</p>
<h2>Unique</h2>
<p>Unique is for rules that are for specific elements only and wont be cascading over any other elements and are limited to only id style rules.<br />
#nav, #header, #content, are all examples of a unique style rule.</p>
<h2>Behavior</h2>
<p>Behavior is for rules that utilize such pseudo CSS as :hover, :active, :link.</p>
<p>Remember this, keep it close&#8230; it is your weapon in the first steps to sorting out all this CSS mess.<br />
After sifting through this our example CSS I have come up with the following.</p>
<pre>/*Repeatin*/
#nav li {float:left; display:block; height:30px; position:relative; list-style:none; list-style-type:none;  padding:0px 10px 0px 10px;}
#nav li a {display:block; float:left; height:30px; color:#000; text-align:center; padding:0px 10px 0px 10px; line-height:30px; text-decoration:none;}
#nav li ul {display:none;}
#nav li li { margin:0px; padding:0px;  background:#000; width:100%; float:left;}
#nav li li a {margin:0px; padding:0px; color:#fff; text-align:left; text-indent:15px; display:block; height:30px; width:100%;}
#leftCol h2 {margin:0px; padding:0px; text-indent:10px;}
#leftCol p {margin:0px; padding:30px; display:block;}
#rightCol h2 {margin:0px; padding:0px; text-indent:10px;}
#rightCol p {margin:0px; padding:30px; display:block;}
/*Uniqure*/
body {margin:0px; padding:0px; text-align:center;}
#wrapper {width:750px; margin-left:auto; margin-right:auto; text-align:left;}
#header {float:left; width:100%; border-bottom:1px #000 solid;}
#header h1 {margin:0px; padding:0px;}
#nav {margin:0px; padding:0px; float:left; display:block; width:100%; height:30px; font-size:12px;}
#middle {float:left; width:100%;}
#leftCol {width:250px; float:left; padding-top:10px;}
#rightCol {width:499px; float:left;  padding-top:10px; border-left:1px #000 solid;}
#footer {float:left; width:100%;}
#footer h3 {display:block; border-top:1px #000 solid; width:90%; margin-left:5%;}
/*Behaviour*/
#nav li a:hover {background:#000; color:#fff; text-decoration:underline;}
#nav li:hover ul {display:block; left:0px; margin:0px; padding:0px; border:1px #000 solid; top:28px; position:absolute; width:130px;}
#nav li li a:hover {background:#fff; color:#000;}</pre>
<p>Sometimes when you are sorting your styles you will be faced with a rule like #header h1, and you have to decide, will I ever have another h1 tag in my header.. most likely not so its safe to call it a unique rule you see.</p>
<p>Now that we have broken our style sheet up into these three areas we are really setup up to start trimming down the code of repeated styles with classes and grouped CSS rules. Let start to optimize this code one group at a time.</p>
<h2>Repeating</h2>
<p>Your first step here would to be to sum up the repeated rules and styles of the leftCol header and paragraph tags as well as the rightCol and its header and paragraphs like so:</p>
<pre>#leftCol h2,#rightCol h2 { text-indent:10px;}
.cols,.cols p,.cols h2 {margin:0px;}
.cols p {padding:30px; display:block;}
.cols h2 {padding:0px;}</pre>
<p>Now lets try to clean up the navigation portion to the layout, here:</p>
<pre>#nav li { position:relative; list-style:none; list-style-type:none;}
#nav li a {color:#000; text-align:center; line-height:30px; text-decoration:none;}
#nav li ul {display:none;}
#nav li li { background:#000; width:100%; border:1px #000 solid;}
#nav li li a {color:#fff; text-align:left; text-indent:15px; width:100%;}
.floatBlock, .floatBlock li, .floatBlock li a, .floatBlock li li, .floatBlock li li a {float:left; display:block; height:30px;}
#nav li li a, #nav li li {margin:0px; padding:0px;}
#nav li, #nav li a { padding:0px 10px 0px 10px;}</pre>
<h2>Unique</h2>
<p>Moving onto the next portion the Unique category of our RUB method here is what I came up with:</p>
<pre>body {text-align:center;}
#nav {float:left; height:30px; font-size:12px;}
body, #header h1, #nav {margin:0px; padding:0px; display:block;  width:100%;}
#wrapper {width:750px; margin-left:auto; margin-right:auto; text-align:left;}
#header {border-bottom:1px #000 solid;}
#leftCol {width:250px;}
#rightCol {width:499px; border-left:1px #000 solid;}
#header,#middle,#footer{float:left; width:100%;}
#leftCol,#rightCol { float:left; padding-top:10px; padding-top:10px;}
#footer h3 {display:block; border-top:1px #000 solid; width:90%; margin-left:5%;}</pre>
<h2>Behavior</h2>
<p>Our last group is for behavior is in most cases if a direct behavior call to a direct element so this is the least cleaned up portions of most style sheets.</p>
<p>Let compare our style sheets file size before and after now, here is our final result.</p>
<pre>/*Repeating*/
#nav li { position:relative; list-style:none; list-style-type:none;}
#nav li a {color:#000; text-align:center; line-height:30px; text-decoration:none;}
#nav li ul {display:none;}
#nav li li { background:#000; width:100%; border:1px #000 solid;}
#nav li li a {color:#fff; text-align:left; text-indent:15px; width:100%;}
.floatBlock, .floatBlock li, .floatBlock li a, .floatBlock li li, .floatBlock li li a {float:left; display:block; height:30px;}
#nav li li a, #nav li li {margin:0px; padding:0px;}
#nav li, #nav li a { padding:0px 10px 0px 10px;}
#leftCol h2,#rightCol h2 { text-indent:10px;}
.cols,.cols p,.cols h2 {margin:0px;}
.cols p {padding:30px; display:block;}
.cols h2 {padding:0px;}
/*Uniqure*/
body {text-align:center;}
#nav {float:left; height:30px; font-size:12px;}
body, #header h1, #nav {margin:0px; padding:0px; display:block;  width:100%;}
#wrapper {width:750px; margin-left:auto; margin-right:auto; text-align:left;}
#header {border-bottom:1px #000 solid;}
#leftCol {width:250px;}
#rightCol {width:499px; border-left:1px #000 solid;}
#header,#middle,#footer{float:left; width:100%;}
#leftCol,#rightCol { float:left; padding-top:10px; padding-top:10px;}
#footer h3 {display:block; border-top:1px #000 solid; width:90%; margin-left:5%;}
/*Behaviour*/
#nav li a:hover {background:#000; color:#fff; text-decoration:underline;}
#nav li:hover ul {display:block; left:0px; margin:0px; padding:0px; top:28px; position:absolute; width:130px;}
#nav li li a:hover {background:#fff; color:#000;}</pre>
<p>Our new cleaned up styles is almost 15b smaller but more importantly our browser will now spend less time over repeated style when downloading the style sheet and keeping it in the computers cache.</p>
<p>So to sum up the CSS RUB method. CSS RUB is a mechetti if you will to organize your style rules before any serious cleaning process takes place. It&#8217;s goal is to give us a better plan for attack when tryin to debug a werid layout issue by breaking our style into these three areas as well as cut down on the amount of time to trim down repeated styles.</p>
<p>CSS RUB = Quick way to RUB out repeated styles and organize your style rules accordingly, simple as that!</p>
<p>Thanks everyone!<br />
<strong>Devin R. Olsen</strong></p>
<p><strong><a title="CSS RUB Method Before Example" href="http://devinrolsen.com/wp-content/themes/typebased/demos/css/css-rub/BEFORE.html">Here is an example of the page before optimizing</a><br />
</strong></p>
<p><strong><a title="CSS RUB Method Example" href="http://devinrolsen.com/wp-content/themes/typebased/demos/css/css-rub/WORKS.html">Here is an example of the CSS RUB method at work on our demo site</a><br />
</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.devinrolsen.com/css-rub-organization/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Layout vs Content Placement</title>
		<link>http://www.devinrolsen.com/layout-vs-content-placement/</link>
		<comments>http://www.devinrolsen.com/layout-vs-content-placement/#comments</comments>
		<pubDate>Sun, 13 Sep 2009 11:50:09 +0000</pubDate>
		<dc:creator>Devin R. Olsen</dc:creator>
				<category><![CDATA[CSS Tutorials]]></category>
		<category><![CDATA[SEO Tutorials]]></category>
		<category><![CDATA[content]]></category>
		<category><![CDATA[content placement]]></category>
		<category><![CDATA[css position]]></category>
		<category><![CDATA[header]]></category>
		<category><![CDATA[header vs content]]></category>
		<category><![CDATA[layout vs content]]></category>
		<category><![CDATA[layout vs structure]]></category>
		<category><![CDATA[SEO tips]]></category>
		<guid isPermaLink="false">http://devinrolsen.com/?p=348</guid>
		<description><![CDATA[Today I wanted to share a little tip with my fellow SEO heads. If content is king, then indeed placement of content on a page is also important. Here is a little trick to make sure your content is always first and foremost for crawlers yet not to disturb your layout and design.]]></description>
			<content:encoded><![CDATA[<p>If content is king, then indeed placement of content on a page is must also be important. Here is a little trick to make sure your content is always first and foremost for crawlers yet not to disturb your layout and design.</p>
<p>This tutorial will cover very little about the pre-made layout but rather how to alter it in a way that will push our sites content to the top in order for search engines to crawl your content faster.</p>
<p>So to begin here is our pre-made standard two column layout.</p>
<pre style="overflow: scroll; height: 300px;">&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
&lt;title&gt;Layout vs. Content Placement with CSS&lt;/title&gt;
&lt;style type="text/css"&gt;
body {text-align:center;}
h1,h2,h3 {margin:0px; padding:0px;}
.row {border:1px #000 dotted; float:left; width:100%;}
#wrapper {width:750px; text-align:left; margin-left:auto; margin-right:auto;}
#header { height:100px;}
.col { border:1px #000 dotted; margin-top:10px; margin-bottom:10px;}
#leftCol {float:left; width:240px; margin-left:10px;}
#rightCol {float:left; width:475px; margin-left:10px;}
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;div id="wrapper"&gt;
		&lt;div id="header" class="row"&gt;
        &lt;h1&gt;Header&lt;/h1&gt;
        &lt;/div&gt;
        &lt;div id="content" class="row"&gt;
            &lt;div id="leftCol" class="col"&gt;
            	&lt;h2&gt;Left Column&lt;/h2&gt;
                &lt;p&gt;Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis.&lt;/p&gt;
                &lt;p&gt;Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis.&lt;/p&gt;
                &lt;p&gt;Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis.&lt;/p&gt;
            &lt;/div&gt;
            &lt;div id="rightCol" class="col"&gt;
                &lt;h2&gt;Content&lt;/h2&gt;
                &lt;p&gt;Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.&lt;/p&gt;
                &lt;h2&gt;Content&lt;/h2&gt;
                &lt;p&gt;Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.&lt;/p&gt;
                &lt;h2&gt;Content&lt;/h2&gt;
                &lt;p&gt;Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.&lt;/p&gt;
            &lt;/div&gt;
        &lt;/div&gt;
        &lt;div id="footer" class="row"&gt;
        &lt;h3&gt;Footer&lt;/h3&gt;
        &lt;/div&gt;
    &lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<p>Lets see what we have.</p>
<p><a href="http://devinrolsen.com/wp-content/uploads/2009/09/twoColFig0.gif"><img src="http://devinrolsen.com/wp-content/uploads/2009/09/twoColFig0.gif" alt="" width="426" height="391" /></a></p>
<p>Perfect, now lets study this traditional layout idealism if you will.</p>
<p>In the above HTML and image you see that the header comes first then our two column content blocks and finally out footer. In most cases our header will contain a navigation menu with many links and sometimes account information links. In the eyes of a crawler the header and all its links and menus almost seems like a mini site map that in a lot of cases, contains links that are very minimally relevant to the topic or page at hand.</p>
<p>So I ask you, wouldn&#8217;t it be nice to be able to flip the positions of the header and the content blocks in the eyes of a search engine crawlers so that our content comes first, then our header and links, and finally our footer? How would we do such a thing without disturbing our layout?</p>
<p>Simple my friends we will use the magic of CSS positions to trick our browsers into placing our header above our content block.</p>
<p>First lets move the html content block above our header like so:</p>
<pre>&lt;div id="wrapper"&gt;
    &lt;div id="content" class="row"&gt;
        &lt;div id="rightCol" class="col"&gt;
            &lt;h2&gt;Content&lt;/h2&gt;
            &lt;p&gt;Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.&lt;/p&gt;
            &lt;h2&gt;Content&lt;/h2&gt;
            &lt;p&gt;Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.&lt;/p&gt;
            &lt;h2&gt;Content&lt;/h2&gt;
            &lt;p&gt;Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.&lt;/p&gt;
        &lt;/div&gt;
        &lt;div id="leftCol" class="col"&gt;
            &lt;h2&gt;Left Column&lt;/h2&gt;
            &lt;p&gt;Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis.&lt;/p&gt;...
        &lt;/div&gt;
    &lt;/div&gt;
    &lt;div id="header" class="row"&gt;
    &lt;h1&gt;Header&lt;/h1&gt;
    &lt;/div&gt;
    &lt;div id="footer" class="row"&gt;
    &lt;h3&gt;Footer&lt;/h3&gt;
    &lt;/div&gt;
&lt;/div&gt;</pre>
<p>Now lets see what we have here:<br />
<a href="http://devinrolsen.com/wp-content/uploads/2009/09/twoColFig1.gif"><img class="alignnone size-full wp-image-399" title="twoColFig1" src="http://devinrolsen.com/wp-content/uploads/2009/09/twoColFig1.gif" alt="twoColFig1" width="426" height="391" /></a></p>
<p>Just as suspected now our header is below our content block and this is just not going to work for us. So lets move back up to our CSS and give some positioning rules to a few elements.</p>
<p>First things first, we are going to give our &#8220;<strong>#wrapper</strong>&#8221; style rule a position of relative:</p>
<pre>#wrapper {width:750px; text-align:left; margin-left:auto; margin-right:auto; <em><strong>position:relative;</strong></em>}</pre>
<p>Next lets give our &#8220;<strong>#header</strong>&#8221; style rule a position of absolute and a top left of zero pixels:</p>
<pre>#header { height:100px; position:absolute; top:0px; left:0px;}</pre>
<p>Great so what we have done is gave both our header element a position of absolute to break it out of the flow of our design so we can place it where ever we like. We also gave the parent a position of relative to stop the header element from breaking out of the flow of our design any further than this point.</p>
<p>Great lets take a look-see at what we have done now shall we:</p>
<p><a href="http://devinrolsen.com/wp-content/uploads/2009/09/twoColFig2.gif"><img class="alignnone size-full wp-image-400" title="twoColFig2" src="http://devinrolsen.com/wp-content/uploads/2009/09/twoColFig2.gif" alt="twoColFig2" width="425" height="391" /></a></p>
<p>OOPS, it seems to be that our header and content block are now overlapping each other! Ok to be honest I knew this was going to happen but I wanted to show you what happens when you use a position of absolute to break an element out of the flow of design. Now that the header is no long part of this &#8220;block like structure&#8221; of its sibling elements, they can overlap each other.</p>
<p>How do we fix this? Simple, lets move back over to our &#8220;<strong>#wrapper</strong>&#8221; element and give it a padding top style that equals the same height as our &#8220;<strong>#header</strong>&#8221; element.</p>
<pre>#wrapper {width:750px; text-align:left; margin-left:auto; margin-right:auto; <strong>position:relative; <em>padding-top:100px;</em></strong>}</pre>
<p>What we have done here is told our &#8220;<strong>#wrapper</strong>&#8221; element to push down all elements who follow our layouts flow down from the top by 100 pixels or again the same desired height as our header.</p>
<p>look and see what our results are:</p>
<p><a href="http://devinrolsen.com/wp-content/uploads/2009/09/twoColFig0.gif"><img class="alignnone size-full wp-image-397" title="twoColFig0" src="http://devinrolsen.com/wp-content/uploads/2009/09/twoColFig0.gif" alt="twoColFig0" width="425" height="390" /></a></p>
<p>Great so now with CSS we have made it appear as if our layouts structure is header, content then footer but in reality we have our content before all other elements. Here is what this would look like to a crawlers entering the page looking for content relative to the pages topic.</p>
<p><a href="http://devinrolsen.com/wp-content/uploads/2009/09/oneColFig6.gif"></a><a href="http://devinrolsen.com/wp-content/uploads/2009/09/twoColFig3.gif"><img class="alignnone size-full wp-image-401" title="twoColFig3" src="http://devinrolsen.com/wp-content/uploads/2009/09/twoColFig3.gif" alt="twoColFig3" width="426" height="391" /></a></p>
<p>Wow this is perfect, but hmm something still bugs me. The left and right columns could be flipped as well beings that in most scenarios the right column will contain the meat or rather more relative type of content to a pages topic. So how would we go about flipping these two?</p>
<p>Instead of using position rules, we can look at the float side of this technique if you will. Its kinda a rule of thumb here tha when we are trying to move elements or rows up or down over or under each other we want to use positions, but for columns that site next to each other it much better to use floats.</p>
<p>To begin simple change the &#8220;<strong>#rightCol</strong>&#8221; rule&#8217;s float and margin-left to right like so:</p>
<pre><strong>#rightCol {float:<em>right</em>; width:475px; display:inline; margin-<em>right</em>:10px;}</strong></pre>
<p>Now that we have gave specific rules to both the left and right columns to either float left or right, belive it or not we can flip then in any order we want now. So go back to these two elements flip them so the right column comes for the left column like so:</p>
<pre>&lt;div id="rightCol" class="col"&gt;
    &lt;h2&gt;Content&lt;/h2&gt;
    &lt;p&gt;Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.&lt;/p&gt;
    &lt;h2&gt;Content&lt;/h2&gt;
    &lt;p&gt;Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.&lt;/p&gt;
    &lt;h2&gt;Content&lt;/h2&gt;
    &lt;p&gt;Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.&lt;/p&gt;
&lt;/div&gt;
&lt;div id="leftCol" class="col"&gt;
    &lt;h2&gt;Left Column&lt;/h2&gt;
    &lt;p&gt;Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis.&lt;/p&gt;
    &lt;p&gt;Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis.&lt;/p&gt;
    &lt;p&gt;Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis.&lt;/p&gt;
&lt;/div&gt;</pre>
<p>Let see our results:</p>
<p><a href="http://devinrolsen.com/wp-content/uploads/2009/09/twoColFig0.gif"><img class="alignnone size-full wp-image-397" title="twoColFig0" src="http://devinrolsen.com/wp-content/uploads/2009/09/twoColFig0.gif" alt="twoColFig0" width="425" height="389" /></a></p>
<p>Everything looks great from the layout or rather visual side of things, lets see how we did on the structure side of things:</p>
<p><a href="http://devinrolsen.com/wp-content/uploads/2009/09/twoColFig4.gif"><img class="alignnone size-full wp-image-402" title="twoColFig4" src="http://devinrolsen.com/wp-content/uploads/2009/09/twoColFig4.gif" alt="twoColFig4" width="450" height="412" /></a></p>
<p>PERFECT! Both structurally and visually sound right? &#8230;</p>
<h3>IE Fix</h3>
<p>Now IE rears its ugly head yet again with a common bug that I need to point out. First this is a technique not a method set in stone, each layout will have its differences and challenges, but all should be able to work their way into this solution.</p>
<p>Most layouts will make use of floats and widths of a 100% in their row elements. IE however when having sibling elements who use floats and widths such as this while also trying to also utilize a position of absolute will make this positioned element disappear from the layout. Good news is that its only in version IE5 and IE6, the even better news is there is a CSS solution to this bug.</p>
<p>Again because the header element is trying to use a position of absolute while its sibling elements use floats and widths, IE5 and IE6 will hide the header from view. The solution is to isolate these two browsers from using floats on our sibling elements by going to the &#8220;<strong>.row</strong>&#8221; class in our css and give &#8220;<strong>!importance</strong>&#8221; to all other browsers to use floats and for IE5 and IE6 to now use floats like so:</p>
<pre>.row {border:1px #000 dotted; <strong><em>float:left !important; float:none;</em></strong> width:100%;}</pre>
<p>I only wanted to point this bug out to you because as I stated each layout will have its own unique challenges, and this seems to be the most common bug you will run into first so it&#8217;s always help full to know why if not when this occurs to you.</p>
<p>And that&#8217;s Layout vs Content Placement everyone!</p>
<p><strong>Devin R. Olsen</strong></p>
<p><strong><a title="Layout vs Content Placement Example" href="http://devinrolsen.com/wp-content/themes/typebased/demos/seo/layout-vs-position/WORKS.html">Here is a working example of what this tutorial covers.</a><br />
</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.devinrolsen.com/layout-vs-content-placement/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Pure CSS Vertical Menu</title>
		<link>http://www.devinrolsen.com/pure-css-vertical-menu/</link>
		<comments>http://www.devinrolsen.com/pure-css-vertical-menu/#comments</comments>
		<pubDate>Thu, 10 Sep 2009 02:32:13 +0000</pubDate>
		<dc:creator>Devin R. Olsen</dc:creator>
				<category><![CDATA[CSS Tutorials]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[css only menu]]></category>
		<category><![CDATA[only css menu]]></category>
		<category><![CDATA[pure css]]></category>
		<category><![CDATA[pure css vertical menu]]></category>
		<category><![CDATA[vertical menu]]></category>
		<guid isPermaLink="false">http://devinrolsen.com/?p=40</guid>
		<description><![CDATA[Today we are going to build the second most common menu navigation, the vertical navigation menu. Here we are going to be using only pure CSS and un-ordered lists to create our vertical navigation menu with three levels of pop outs. This version of the vertical navigation menu will work in IE5, IE6, IE7 and [...]]]></description>
			<content:encoded><![CDATA[<p>Today we are going to build the second most common menu navigation, the vertical navigation menu. Here we are going to be using only pure CSS and un-ordered lists to create our vertical navigation menu with three levels of pop outs. This version of the vertical navigation menu will work in IE5, IE6, IE7 and IE8 as well as FF and Safari.<br />
Let’s begin shall we. To start lets create our menus container block and give it an id of “navigation”.</p>
<pre>&lt;div id="navigation"&gt;
&lt;/div&gt;</pre>
<p>Next we will add our first level menu items.</p>
<pre>&lt;div id="navigation"&gt;
    &lt;ul&gt;
        &lt;li&gt;&lt;/li&gt;
        &lt;li&gt;&lt;/li&gt;
        &lt;li&gt;&lt;/li&gt;
        &lt;li&gt;&lt;/li&gt;
        &lt;li&gt;&lt;/li&gt;
    &lt;/ul&gt;
&lt;/div&gt;</pre>
<p>After this we are going to give our list items some names.</p>
<pre>&lt;div id="navigation"&gt;
    &lt;ul&gt;
        &lt;li&gt;Home&lt;/li&gt;
        &lt;li&gt;About&lt;/li&gt;
        &lt;li&gt;Contact&lt;/li&gt;
        &lt;li&gt;FAQ&lt;/li&gt;
        &lt;li&gt;News&lt;/li&gt;
    &lt;/ul&gt;
&lt;/div&gt;</pre>
<p>Great let’s see what we have so far.</p>
<p><a href="http://devinrolsen.com/wp-content/uploads/2009/09/fig0.gif"><img class="alignnone size-full wp-image-227" title="fig0" src="http://devinrolsen.com/wp-content/uploads/2009/09/fig0.gif" alt="fig0" /></a></p>
<p>Obviously it’s not going to work for us, but I think it’s important to point out that the vertical fashion that is given to us by default in the ordered list is here to help us. The vertical menu and un-ordered list almost seems to be a match made in CSS heaven vs. its sister menu the horizontal navigation menu.<br />
So let begin to add some style to our first level un-ordered list and its parent container “navigation” shall we.</p>
<p>In our header we create some style tags that will contain all our CSS. Our first CSS rule we want to add would be for our container.</p>
<pre>&lt;style type="text/css"&gt;
    #navigation {width:150px; font-size:12px;}
&lt;/style&gt;</pre>
<p>Here we are going to give our main container some structure by setting its width to 150 pixels; we also set our menus font size to that of 12 pixels that will cascade down our entire menu.<br />
Great next we are going to create a rule for our first level un-ordered list.</p>
<pre>&lt;style type="text/css"&gt;
    #navigation {width:150px; font-size:12px;}
    <strong>#navigation ul {margin:0px; padding:0px; background-color:#666;}</strong>
&lt;/style&gt;</pre>
<p>Ok here we are pointing to our “navigation” container first, then our first un-ordered list and assigning styles accordingly. We have removed the default margin and padding that comes with a un-ordered list by setting both to 0 pixels. For style sakes we set our first un-ordered list’s background color to #	666.</p>
<p>Ok let’s see what we have so far.</p>
<p><a href="http://devinrolsen.com/wp-content/uploads/2009/09/fig2.gif"></a><a href="http://devinrolsen.com/wp-content/uploads/2009/09/fig1.gif"><img class="alignnone size-full wp-image-228" title="fig1" src="http://devinrolsen.com/wp-content/uploads/2009/09/fig1.gif" alt="fig1" /></a></p>
<p>Again not looking to hot right now, but we will get there. Our next step is to assign some styles to our un-ordered list items. We do this by again pointing to our “navigation” container; its first un-ordered list, and then our list items.</p>
<pre>#navigation {width:150px; font-size:12px;}
#navigation ul {margin:0px; padding:0px; background-color:#666;}
<strong>#navigation ul li {
height:25px;
line-height:25px;
list-style:none;
padding-left:10px;
color:#FFF;
border-top:#fff solid;
border-bottom:#fff solid;
border-width:1px;
cursor:pointer;
}</strong></pre>
<p>Ok here we have a lot of styling to give to these list items that will cascade down our entire menus look and feel for the rest of the menus list items. So to begin we remove our default un-ordered list item styles, or rather bullets next to each list item. Next we set a height of 25 pixels to space our list items out vertically a little, but at the same time make up for text placement by using the line-height and left padding.</p>
<p>For the line-height, we set it exactly the desired height of the list item in order to center our text vertical within the list item. Our padding-left style is to move each list items text off the left site by 15 pixels. Our last CSS styles are purely for preference and deal with border colors and thickness, font color and cursor types. These last styles may also change according to your design.</p>
<p>Let’s take a look shall we.</p>
<p><a href="http://devinrolsen.com/wp-content/uploads/2009/09/fig3.gif"></a><a href="http://devinrolsen.com/wp-content/uploads/2009/09/fig2.gif"><img class="alignnone size-full wp-image-229" title="fig2" src="http://devinrolsen.com/wp-content/uploads/2009/09/fig2.gif" alt="fig2" /></a></p>
<p>Ok not too bad.</p>
<p>Before we move onto creating our second level sub menu, lets add some behavior to our menu shall we. Let’s give a color difference to our list items background color if we are hovering over them.</p>
<p>To do this we again reference to our “navigation” container first, then our first un-ordered list and then our list items them self. Once we are pointing to our menus list items we add a pseudo hover to begin the statement for our behavior.</p>
<pre>#navigation {width:150px; font-size:12px;}
#navigation ul {margin:0px; padding:0px; background-color:#666;}
#navigation ul li {
height:25px;
line-height:25px;
list-style:none;
padding-left:10px;
color:#FFF;
border-top:#fff solid;
border-bottom:#fff solid;
border-width:1px;
cursor:pointer;
}
<strong>#navigation ul li:hover {background-color:#F90; position:relative;}</strong></pre>
<p>Here we are giving our list items a background-color of #F90 and set its position to be that of “relative”. We use relative because it turns our list items into stopping points for any immediate children that have a position of absolute vs. having the absolute element break out of our menu all together. We also get the position of relative to our list items here at the hover state in order to fix IE related issues.</p>
<p>Ok so here is what our menu behavior looks like.</p>
<p><a href="http://devinrolsen.com/wp-content/uploads/2009/09/fig4.gif"></a><a href="http://devinrolsen.com/wp-content/uploads/2009/09/fig3.gif"><img class="alignnone size-full wp-image-230" title="fig3" src="http://devinrolsen.com/wp-content/uploads/2009/09/fig3.gif" alt="fig3" /></a></p>
<p>Ok now we must move into our second level un-ordered list. We always nest our sub menus deeper within the list item we want it to be displayed under.</p>
<p>So make your HTML look like the following:</p>
<pre>&lt;div id="navigation"&gt;
    &lt;ul&gt;
        &lt;li&gt;Home
            &lt;ul&gt;
                &lt;li&gt;Sub Menu Item 1&lt;/li&gt;
                &lt;li&gt;Sub Menu Item 2&lt;/li&gt;
                &lt;li&gt;Sub Menu Item 3&lt;/li&gt;
                &lt;li&gt;Sub Menu Item 3&lt;/li&gt;
            &lt;/ul&gt;
        &lt;/li&gt;
        &lt;li&gt;About&lt;/li&gt;
        &lt;li&gt;Contact&lt;/li&gt;
        &lt;li&gt;FAQ
            &lt;ul&gt;
                &lt;li&gt;Sub Menu Item 1&lt;/li&gt;
                &lt;li&gt;Sub Menu Item 3&lt;/li&gt;
            &lt;/ul&gt;
        &lt;/li&gt;
        &lt;li&gt;News
            &lt;ul&gt;
                &lt;li&gt;Sub Menu Item 1&lt;/li&gt;
                &lt;li&gt;Sub Menu Item 2&lt;/li&gt;
                &lt;li&gt;Sub Menu Item 3&lt;/li&gt;
            &lt;/ul&gt;
        &lt;/li&gt;
    &lt;/ul&gt;
&lt;/div&gt;</pre>
<p>Ok notice how we have added entirely new un-ordered lists to our first level list items we want a sub menu to appear. Great let’s move back up to our CSS and begin to set some visual rules to these second level un-ordered lists.<br />
To give ruling to these second level un-ordered lists we again must traverse past our “navigation” container to our first level un-ordered list and then to our second un-ordered list like so.</p>
<pre><strong>#navigation ul ul {
display:none;
position:absolute;
left:75px;
top:5px;
border:#fff solid;
border-width:1px;
background-color:#999;
}</strong></pre>
<p>Here we are giving our second un-ordered list a display of none. We do this so that by default, our second level un-ordered lists are hidden until told so. Next we set our second un-ordered list to be a position of absolute so we may position it according to the location of its parent relative element. To position our absolute second level un-ordered lists we use the top and left styles. Our last styles are of preference and are for borders, border widths and background colors and may change in your design.</p>
<p>Ok so we have written our second level un-ordered list’s off behavior state so we now have to write our display  behavior state. To do this we point to the first level un-ordered list and instate a pseudo hover. Next  we point to our second level un-ordered list and give a display of block to display it out upon its parent being hovered, like so.</p>
<pre>#navigation ul ul {
display:none;
position:absolute;
left:75px;
top:5px;
border:#fff solid;
border-width:1px;
background-color:#999;
}
<strong>#navigation ul li:hover ul {display:block;}</strong></pre>
<p>Great just a few more rules and styles are we are complete.</p>
<p>Ok the last two CSS rules for our second level un-orderd list are primarily for structure purposes only. The first rule points to all our second level un-orderd list items and real estates the overall width of 150 pixels to reassure that our sub menu and its items will carry the same width as our overall menu. Next we set a float of left and a display of inline to fix any IE related issues. Finally for personal likes I removed our previously stated border from the second un-orderd list items.</p>
<pre>#navigation ul ul {
display:none;
position:absolute;
left:75px;
top:5px;
border:#fff solid;
border-width:1px;
background-color:#999;
}
#navigation ul li:hover ul {display:block;}
<strong>#navigation ul ul li {border:none; width:150px; float:left; display:inline;} </strong></pre>
<p>The next, and last rule for the second level un-orderd list is for visual purposes only and adds a pseudo hover behaviour to all our second level un-orderd list items. Here we are giving our list items a text decoration of underline and removing any border from list items.</p>
<pre>#navigation ul ul {
display:none;
position:absolute;
left:75px;
top:5px;
border:#fff solid;
border-width:1px;
background-color:#999;
}
#navigation ul li:hover ul {display:block;}
#navigation ul ul li {border:none; width:150px; float:left; display:inline;}
<strong>#navigation ul ul li:hover {text-decoration:underline; border:none;}</strong></pre>
<p>Let’s look at what we have so far.</p>
<p><a href="http://devinrolsen.com/wp-content/uploads/2009/09/fig4.gif"><img title="fig4" src="http://devinrolsen.com/wp-content/uploads/2009/09/fig4.gif" alt="fig4" /></a></p>
<p>Now let’s create our last level un-ordered list. Like before we are going to insert a new un-ordered list and items with in the level and list item we want to trigger or rather pop out this third level un-ordered list.</p>
<p>Here is what our final HTML would look like.</p>
<pre>&lt;div id="navigation"&gt;
    &lt;ul&gt;
        &lt;li&gt;Home
            &lt;ul&gt;
                &lt;li&gt;Sub Menu Item 1&lt;/li&gt;
                &lt;li&gt;Sub Menu Item 2
                    &lt;ul&gt;
                        &lt;li&gt;Sub Sub Menu Item 1&lt;/li&gt;
                        &lt;li&gt;Sub Sub Menu Item 2&lt;/li&gt;
                        &lt;li&gt;Sub Sub Menu Item 3&lt;/li&gt;
                        &lt;li&gt;Sub Sub Menu Item 4&lt;/li&gt;
                    &lt;/ul&gt;
                &lt;/li&gt;
                &lt;li&gt;Sub Menu Item 3&lt;/li&gt;
                &lt;li&gt;Sub Menu Item 3&lt;/li&gt;
            &lt;/ul&gt;
        &lt;/li&gt;
        &lt;li&gt;About&lt;/li&gt;
        &lt;li&gt;Contact&lt;/li&gt;
        &lt;li&gt;FAQ
            &lt;ul&gt;
                &lt;li&gt;Sub Menu Item 1&lt;/li&gt;
                &lt;li&gt;Sub Menu Item 3
                    &lt;ul&gt;
                        &lt;li&gt;Sub Sub Menu Item 1&lt;/li&gt;
                        &lt;li&gt;Sub Sub Menu Item 2&lt;/li&gt;
                        &lt;li&gt;Sub Sub Menu Item 3&lt;/li&gt;
                        &lt;li&gt;Sub Sub Menu Item 4&lt;/li&gt;
                    &lt;/ul&gt;
                &lt;/li&gt;
            &lt;/ul&gt;
        &lt;/li&gt;
        &lt;li&gt;News
            &lt;ul&gt;
                &lt;li&gt;Sub Menu Item 1
                    &lt;ul&gt;
                        &lt;li&gt;Sub Sub Menu Item 1&lt;/li&gt;
                        &lt;li&gt;Sub Sub Menu Item 2&lt;/li&gt;
                        &lt;li&gt;Sub Sub Menu Item 3&lt;/li&gt;
                        &lt;li&gt;Sub Sub Menu Item 4&lt;/li&gt;
                    &lt;/ul&gt;
                &lt;/li&gt;
                &lt;li&gt;Sub Menu Item 2&lt;/li&gt;
                &lt;li&gt;Sub Menu Item 3&lt;/li&gt;
            &lt;/ul&gt;
        &lt;/li&gt;
    &lt;/ul&gt;
&lt;/div&gt;</pre>
<p>Great, because we have already stated most visual styles we want our menu to carry, these last few rules and styles are for structure only. To start we add a reset rule if you will, that will basically prevent our third level un-ordered list from being displayed until its proper parent and un-ordered list level has been hovered over. In other words, we don’t want our third level un-ordered list to be displayed when our first level un-ordered list is being hovered over but rather display it&#8217;s self only when our second level un-ordered list is hovered.</p>
<p>Here is what this reset would look like.</p>
<pre><strong>#navigation li:hover ul li ul {display:none;}</strong></pre>
<p>Great let’s move onto the last few rules. Our first one is to offset our third level un-ordered list to the left further than its parent un-ordered list level. So again point to our third level un-ordered list and give it a left style of 110 pixels. I also added a different color background color here for kicks and to demonstrate you can define styles even further if you wish.</p>
<pre>#navigation li:hover ul li ul {display:none;}
<strong>#navigation ul &gt; ul &gt; ul &gt; ul ul li ul {left:110px; background-color:#0099CC;}</strong></pre>
<p>Ok now we already created a reset rule that would keep our third level un-ordered list from being displayed, let’s crate our last rule that will finally display our third level un-ordered list out.</p>
<pre>#navigation li:hover ul li ul {display:none;}
#navigation ul &gt; ul &gt; ul ul li ul {left:110px; background-color:#0099CC;}
<strong>#navigation ul &gt; ul ul li:hover ul {display:block;}</strong></pre>
<p>Great so here we point all the way down to our second level un-ordered list and assign a pseudo hover behavior to it. We then move onto pointing at the third level un-ordered list and set a display of block.<br />
Let have a look-see at what our vertical menu now looks like shall we?</p>
<p><a href="http://devinrolsen.com/wp-content/uploads/2009/09/fig5.gif"><img class="alignnone size-full wp-image-232" title="fig5" src="http://devinrolsen.com/wp-content/uploads/2009/09/fig5.gif" alt="fig5" /></a></p>
<p>Thats it everyone, you have just created a pure CSS vertical menu with sub level pop outs that is completely cross browser friendly.</p>
<p><a href="http://devinrolsen.com/wp-content/themes/typebased/demos/css/vertical-menu/WORKS.html">Here is a working example of the pure CSS vertical menu</a></p>
<p>PLEASE NOTE: The above example works in IE5 and IE6 because of the <a href="http://www.devinrolsen.com/fix-css-pseudo-hover/">pseudo-hover fix</a> that can be found here. Please read this pseudo-hover fix tutorial if you are trying to get this or even the <a href="http://www.devinrolsen.com/pure-css-horizontal-menu/">Pure CSS Horizontal Menu</a> to work in older versions of IE.</p>
<h3><a href="http://www.devinrolsen.com/pure-css-menu-with-infinite-sub-menus-tutorial/" target="_blank">[IF YOU WANT AN INFINITE AMOUNT OF SUB MENUS PLEASE REFER TO THIS TUTORIAL.]</a></h3>
<p>Thanks everyone.</p>
<p>Devin R. Olsen</p>
]]></content:encoded>
			<wfw:commentRss>http://www.devinrolsen.com/pure-css-vertical-menu/feed/</wfw:commentRss>
		<slash:comments>79</slash:comments>
		</item>
		<item>
		<title>Three Column Layout in Less Than Ten Lines of CSS</title>
		<link>http://www.devinrolsen.com/three-column-layout-ten-lines-of-css/</link>
		<comments>http://www.devinrolsen.com/three-column-layout-ten-lines-of-css/#comments</comments>
		<pubDate>Thu, 10 Sep 2009 02:30:57 +0000</pubDate>
		<dc:creator>Devin R. Olsen</dc:creator>
				<category><![CDATA[CSS Tutorials]]></category>
		<guid isPermaLink="false">http://devinrolsen.com/?p=81</guid>
		<description><![CDATA[Many developers have dedicated their time and efforts such as me to try to move developers over to the proper standards of web code and away from older or non w3c approaches to site designs. One of these long used but improper approaches to site designs is the dreaded table use for your sites layout.
Tables [...]]]></description>
			<content:encoded><![CDATA[<p>Many developers have dedicated their time and efforts such as me to try to move developers over to the proper standards of web code and away from older or non w3c approaches to site designs. One of these long used but improper approaches to site designs is the dreaded table use for your sites layout.</p>
<p>Tables were never meant to be a websites layout backbone as IE and Microsoft FrontPage have been advocating for years. Today however most developers know to stay away from tables unless to display data in an actual table format and now stick to XHTML and block elements such as division boxes (<strong>&lt;div&gt;&lt;/div&gt;</strong>).</p>
<p>The problem that arises is that even though the use of CSS and block elements actually gives us the developers a more dynamic and cleaner way for working with complex layout structures it lacks some of the essentials in creating what we consider to be a standard layout in the ideals of web design. One of these paradoxes is the three column layout and our understanding of how this layout should act according to how we all have grown with the web. If you think about what you would consider a three column layout to be and how it should function you might come up with the following:</p>
<ul>
<li>Any column height determines the overall height of the layout.</li>
<li>Fluid layout and wont break under browser font size changes.</li>
<li>Column colors and center cell color can differ.</li>
<li>Column colors and center cell color can extend to the full height of the layout.</li>
</ul>
<p>Seems simple enough, but in fact many great minds have been trying to accomplish the best approach to meet these four simple requirements or more with use of XHTML and CSS for years were a table three column layout can already achieve this. I myself have been spending a great amount of time trying to come up with the most compliant and cross browser friendly method that achieves the above requirements for a three column layout. My first attempts were to try to study what is already out there and see what ground has been broken in this three column layout battle and I found lots of creative yet very similar method out there that even got me distracted from what might be accomplished is you simply would think outside of the box.</p>
<p>Everything I had found tackled the three column layout and above requirements by doing what we have been taught for years now about proper block element design and that is something call the box model method that says we must nest elements to properly apply padding, margin and height styles. So it was no wonder that I too got sucked into this approach to accomplish the perfect three column layout. What I found that if you simple stop and rethink maybe even give and take a little you can accomplish this three column layout but do so while making it completely cross browser friendly and less than 10 lines of CSS.</p>
<p>Yes you read right I did say that I have accomplished this most sought after layout with less than 10 lines of CSS code. So with the little history lesson out-of-the-way and our full understanding as to why were are even sitting here talking about this layout we can begin to get started with this tutorial.</p>
<p>In this tutorial I am going to show you how to create the  perfect three column layout. This three column layout is designed under the  common screen resolution of (1024&#215;768) and meets all of our above requirements  while again under 10 lines of CSS code! Let’s get started by first creating our  html structure for our three column layout.</p>
<pre>&lt;div id="main"&gt;
    &lt;div id="wrapper"&gt;
        &lt;div id="header" class="caps"&gt;
        &lt;/div&gt;
        &lt;div class="column"&gt;
            &lt;div&gt;
            &lt;/div&gt;
        &lt;/div&gt;
        &lt;div class="center"&gt;
            &lt;div&gt;
            &lt;/div&gt;
        &lt;/div&gt;
        &lt;div class="column"&gt;
            &lt;div&gt;
            &lt;/div&gt;
        &lt;/div&gt;
        &lt;div id="footer" class="caps"&gt;
        &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;</pre>
<p>Ok so far this is a great structure to create a three column  layout. We have our header and our footer boxes not always a must but give our  layout that desired look we are after. Next we have our two left and right  columns and in the center of the two we have our center column. Each column has  a nested div box in order for us to add padding to our columns and the content  they will hold.</p>
<p>Ok now let’s move on to our CSS portion of this tutorial.</p>
<pre>body{}
#main{}
#wrapper{}
#header{}
#footer{}
.column{}
.center{}
.caps{}
.column div, .center div {}</pre>
<p>Let us break down the first five CSS rules.</p>
<pre>body {text-align:center; background-color:#ccc;}
#main{margin-left:auto; margin-right:auto; width:980px;}
#wrapper{float:left;}
#header{height:90px; border-bottom:#ccc solid; border-width:1px;}
#footer{height:30px; border-top:#ccc solid; border-width:1px;}</pre>
<p>Our first rule is pointing directly to our documents <strong>body</strong> tag and has a text align of center and a background color of light gray. I set  our body&#8217;s tag to have a text align of center for IE5 browser to center our  proceeding child elements to the pages over all width and I gave our body a  background color to contrast our three column layout once it’s finished.</p>
<p>Our next rule is named <strong>#main</strong> that has two margin rules  (margin-left and margin-right) both of which are set to auto. We also give a  set width of 980px to our #main rule. We set its margins to auto in order to  align it to the center of our pages over all width and give it a width of 980px  for a safe real state under a 1024&#215;768 standard screen resolutions.</p>
<p>Next is our rule named <strong>#wrapper</strong> and it has a float rule of  left to properly float any child elements nested within it that also carry a  float rule.</p>
<p>Our last two rules (<strong>#header &amp; #footer</strong>) are for our header  and footer elements that are self-explanatory and of user preference.</p>
<p>Moving on lets look at our next two CSS class rules.</p>
<pre>.column{width:165px; float:left;}
.center{width:650px; float:left;}</pre>
<p>Our first class rule is <strong>.column</strong> and is a rule for both our  left and right columns and has a width of 165px and another float set to a left  in order to properly float all our columns next to each other rather than over  each other.</p>
<p>Our next class rule is <strong>.center</strong> and is for our center column.  This class rule also has a width and float rule but this time I use the  remaining width of our 980px to fill up with our center column. (<strong>980 -165 -165  = 650</strong>)</p>
<p>And last but not least our last two CSS class rules.</p>
<pre>.caps{width:980px; float:left; background-color:#FFF;}
.column div, .center div {padding:15px}</pre>
<p>Ok so our first class rule here is .caps and is used in our  header and footer elements. I call it caps but because visually it’s like a  soda can, our header and footer elements cap both the top and bottom of our  three column layout. This rule &#8220;.caps&#8221; has a width of 980px to span  our fully allowed width and again a float left rule to properly stack header  and footer over and under their sibling elements.</p>
<p>Now our last CSS class rule points to our left and right  columns child div element <strong>.column div</strong> as well as our center columns child div  element <strong>.center div</strong>. This rule gives all column children div elements a padding  style of 15px around all sides to space out content within each column.</p>
<p>Great now we have a complete understanding of our HTML  structure and our CSS rules it’s time to point out what makes this approach so different  from the others. Remember our requirements?</p>
<ul>
<li>Any column height determines the overall height of the layout.</li>
<li>Fluid layout and wont break under browser font size changes.</li>
<li>Column colors and center cell color can differ.</li>
<li>Column colors and center cell color can extend to the full height of the layout.</li>
</ul>
<p>Ok right now as this tutorial stands we have successfully completed  3 out of the 4 requirements for our three column layout. The only one that is  not yet fulfilled is the last requirement.</p>
<p>&#8220;<em>Column colors and center cell color can extend to the full height of the layout.</em>&#8221;</p>
<p>If  I was to go in to our column classes and play around with our columns  background colors we indeed are in control of each of our columns color. The  problem is however once you begin to add content to anyone of the columns you  soon realize that the colors of each column do not extend to the full height of  the layout when extending the layouts height manually with content in any one  of the columns.</p>
<p>The solution to our last requirement is not one of pure CSS,  CSS hacks, box model padding and margin tricks. What I suggest is a background  image to define all three columns and colors that can span the full height of  our <strong>#wrapper</strong> CSS rule. In Photoshop I have created an image that has a width of  980px (our respected real state for a standard screen resolution) and a height  of 500px. I then divide up the image in to our three column sizes (<strong>left</strong>=165px  <strong>center</strong>=650px <strong>right</strong>=165px) and added a drop shadow to my left and right sides  that points in over my center column like so.</p>
<p><img src="images/fig1.gif" alt="three column layout background" /></p>
<p>Next change the canvas size of this image to be that of only  1px so our browser only has to load a tiny strip of our background image and  with the use of CSS we will tell our browsers to repeat the image vertically  for us. By making our image only 1px tall it makes our background load nearly  at 1 second down all the way to a 14.4 dial up modem so no poor loading times  should result from this method.</p>
<p>Now in Photoshop save the image for web and make it a gif  image and name it whatever you like. My background image has drop shadows that  consume up to 9 shades of gray so I tell my save for web dialog to only utilize  up to 9 colors for my background gif. The color utilization for you and your  own background color will vary so please take note of this.</p>
<p>Our last step is to go back to our <strong>#wrapper</strong> CSS rule and add  our new background image and repeat it vertically.</p>
<pre>#wrapper{float:left; <strong>background:url(images/standard.gif) top left repeat-y;</strong>}</pre>
<p>See how we have added a background rule (not a  background-image rule) this rule supports images, alignment and repeat styles.  URL is the location of the image relative to our document and top left is how I  want to position the image in my elements background while repeat-y repeats the  image in a y-axis (vertically).</p>
<p>That’s it folks, we have successfully created a  fully cross browser friendly three column layout in under 10 lines of CSS code.</p>
<p><strong>CONCLUSION</strong><br />
Some may say that this is not the best way to accomplish this three column layout with our above requirements while at the same time will point to far more complex and long-winded  CSS rules to accomplish the same three column layout. Some of these complex  methods to the three column layout consist of hacks to make them cross browser  friendly or simply do not support all browsers. This is simply a method I like to use for the convenience of it and light weight / simplicity  of the structure and CSS.</p>
<h3><a title="Three Column Layout Example" href="http://devinrolsen.com/wp-content/themes/typebased/demos/css/three-column-layout/WORKS.html">VIEW WORKING EXAMPLE NOW</a></h3>
<p><strong>Thanks I hope this helps a few other there.</strong><br />
<strong>Devin R. Olsen</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.devinrolsen.com/three-column-layout-ten-lines-of-css/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>The !important Use In CSS</title>
		<link>http://www.devinrolsen.com/the-important-use-in-css/</link>
		<comments>http://www.devinrolsen.com/the-important-use-in-css/#comments</comments>
		<pubDate>Thu, 10 Sep 2009 02:29:45 +0000</pubDate>
		<dc:creator>Devin R. Olsen</dc:creator>
				<category><![CDATA[CSS Tutorials]]></category>
		<guid isPermaLink="false">http://devinrolsen.com/?p=79</guid>
		<description><![CDATA[Sometimes we must isolate out specific versions of IE that give us grief as developers. There have been many discovered avenues in isolating certain versions of IE out of our style scheme to give specific instructions to, but none are as subtle as the !important. That’s right the !important use is for IE related issues [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes we must isolate out specific versions of IE that give us grief as developers. There have been many discovered avenues in isolating certain versions of IE out of our style scheme to give specific instructions to, but none are as subtle as the !important. That’s right the !important use is for IE related issues ONLY! Aside from the ridicules fact that we have a procedure to make this one browser obey our code, let’s look at how the !important procedure works and can help us.</p>
<p>!important is basically giving importance to a style over all other browsers except IE6 and below. IE6 and below can’t recognize it, therefore skips over our style and hunts for another of its kind. Again because we are giving our style importance, all other browser will do the opposite and only read our important style and skip over any others.</p>
<p>So let’s say we want all browsers except IE6 and below to give an element a width of 500 pixels, but in IE6 and below we want this same element to have a width of say 502 pixels. We would simply use the !important helper as follows:</p>
<pre>#element {width:500px !important; width:502px;}</pre>
<p>Simple as that folks, now everyone in browsers who are IE6 and above equivalence will see this element at a width of 500 pixels while IE6 and below will receive our 502 pixels.</p>
<p>That was painless right?</p>
<p>Devin R. Olsen</p>
]]></content:encoded>
			<wfw:commentRss>http://www.devinrolsen.com/the-important-use-in-css/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Rounded Corners with CSS and One Image</title>
		<link>http://www.devinrolsen.com/rounded-corners-with-css-and-one-image/</link>
		<comments>http://www.devinrolsen.com/rounded-corners-with-css-and-one-image/#comments</comments>
		<pubDate>Thu, 10 Sep 2009 02:28:40 +0000</pubDate>
		<dc:creator>Devin R. Olsen</dc:creator>
				<category><![CDATA[CSS Tutorials]]></category>
		<category><![CDATA[css corners]]></category>
		<category><![CDATA[css corners one image]]></category>
		<category><![CDATA[css rounded corners]]></category>
		<category><![CDATA[one image round corners]]></category>
		<category><![CDATA[rounded corners]]></category>
		<category><![CDATA[rounded corners one image]]></category>
		<guid isPermaLink="false">http://devinrolsen.com/?p=77</guid>
		<description><![CDATA[Today I want to talk about how to create that rounded corner look you see popping up all over the internet.]]></description>
			<content:encoded><![CDATA[<p>Today I want to talk about how to create that rounded corner look you see popping up all over the internet.</p>
<p><strong>Why rounded corners ?</strong></p>
<p>Well like most web design fads it’s a more dynamic and appealing way to server your site&#8217;s content up to the user.</p>
<p><strong>Are rounded corners necessary?</strong></p>
<p>Absolutely not, but hey back in the beginning of web development neither was a lot of things such as background colors HAHA.</p>
<p><strong>Is this the only way to make rounded corners?</strong></p>
<p>No and I doubt its even the best way it&#8217;s just my technique I like to use you can find hundreds of other rounded corner tutorials out on the net.</p>
<p>(<strong>Note</strong>: In time this technique will be obsolete due to CSS3 and the ability to create rounded corners with purely CSS. You can use CSS3 techniques today but unfortunately a few well used but not so much liked browsers do not support CSS3 yet and most likely won’t for quite some time to come.)</p>
<p>Let’s start off with our blank document.</p>
<pre>&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
&lt;title&gt;Rounded Corners Tutorial&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<p>Now let&#8217;s create  our html structure of our content box and its four corners. I am going to use a combination of a div box and an un-ordered list because its easier to maintain in an actual html document that may have hundreds of lines of code.</p>
<p>Place the following inside your body tags.</p>
<pre>&lt;div class="cell"&gt;
    &lt;ul&gt;
        &lt;li class="tl corner"&gt;&lt;/li&gt;
        &lt;li class="tr corner"&gt;&lt;/li&gt;
         &lt;li class="bl corner"&gt;&lt;/li&gt;
         &lt;li class="br corner"&gt;&lt;/li&gt;
      &lt;/ul&gt;
&lt;/div&gt;</pre>
<p>Now let’s create a few CSS classes for our content cell and its four corners. We use classes because the potential of us using multiple boxes with rounded corners is high. With strict XHTML standards you are only allowed to use CSS id’s for elements that occur once on a page but classes can be used with multiple elements on the same page.</p>
<p>In our documents header tags add the following.</p>
<pre>&lt;style type="text/css"&gt;
.cell{}
.cell ul{}
.cell li{}
&lt;/style&gt;</pre>
<p>We now have three classes in our styles. (<strong>.cell, .cell ul</strong> and <strong>.cell li</strong>) Let’s break down each one so we can get a good idea of what is going to happen with these classes down the line.</p>
<p><strong>.cell {}</strong> is the class for our main div box container that will hold not only our content but also our four corners.</p>
<p><strong>.cell ul {}</strong> is using our first class to point to any un-ordered lists we have inside our content div box.</p>
<p><strong>.cell li {}</strong> is like the (<strong>.cell ul</strong>) in the manor that it too uses (<strong>.cell</strong>) to point to any un-ordered lists we have in our content div box but it&#8217;s specifically pointing to all list items within an un-ordered list that resides in our content div box.</p>
<p>Let’s now start adding properties to our classes. Make your CSS look like the following.</p>
<pre>.cell{
position:relative;
padding:21px;
background-color:#f8c771;
float:left;
display:inline;
}
.cell ul{
margin:0px;
padding:0px;
}
.cell li{
list-style:none;
}</pre>
<p>In our <strong>.cell</strong> class you can see that we have created a background-color and a padding of 21px, I use a padding of 25px because in this tutorial we are going to create some fat rounded corners that are 20px in radius so we use 21px to give us extra 5px padding from our boxes edges and corners. We also use the odd number 21 instead of 20 because some versions of IE mess up upon to great of a font size change resulting in a 1px border on some corners.</p>
<p>We have a background-color property here that is set to my desired color. You may change this background color to whatever you like but <strong>note</strong> that if you do you will have to change our corner image that we will cover here in second to your new background color.</p>
<p>I have also placed a position:relative; property in our <strong>.cell</strong> class because we are going to be using a position of absolute for our four corners. If I didn’t have the position:relative; in our <strong>.cell</strong> then when we set our four corners to be absolute they would be positioned absolute to our document and not absolute to our div box container.</p>
<p>Finlay we have a float of left and display of inline. For IE users that don&#8217;t set a desired width this is important because with our floating our <strong>.cell</strong> things get messed up in versions of IE5 and IE6. As a good practice always include display of inline when floating an element.</p>
<p><strong>.cell ul</strong> has set its properties of margin and padding to 0px in order to make sure our four corners will be fit snug to our content div boxes four corners and have no un-needed spacing that’s automatically created from un-ordered lists.</p>
<p>Last we have a list-style:none; property in our <strong>.cell li</strong>. We use don’t want any list styles such as dots appearing next to each &lt;li&gt; we use in our content box so we take them out with this property.</p>
<p>Next we are going to create classes for our four corners. Add the following to your CSS.</p>
<pre>.tl{}
.tr{}
.bl{}
.br{}</pre>
<p>These classes stand for top left(<strong>.tl</strong>), top right(<strong>.tr</strong>), bottom left(<strong>.bl</strong>) and bottom right(<strong>.br</strong>). Because we are going to be positioning each of these as relatively absolute to our content div box we need to specify their positions.</p>
<p>Add the following property&#8217;s to each of these classes.</p>
<pre>.tl
{top:0px; left:0px; background:url(images/corners.jpg) top left no-repeat;}
.tr
{top:0px; right:0px; background:url(images/corners.jpg) top right no-repeat;}
.bl
{bottom:0px; left:0px; background:url(images/corners.jpg) bottom left no-repeat;}
.br
{bottom:0px; right:0px; background:url(images/corners.jpg) bottom right no-repeat;}</pre>
<p>Ok here you can see we have a top and either left or right property for the top corners. For the bottom corners we use a bottom and either a left or right property and again all these are doing is positioning our corners inside our content box.</p>
<p>Now you might have noticed we are also using a background property for each of these corners. The background property is calling an image I created in Photoshop and we are positioning the image inside of our corners and telling the background not to repeat.</p>
<p>Because this is not a Photoshop tutorial I will just show you the image we are using so you may get a clear idea as to why I have positioned the image and set a no-repeat in each corner.</p>
<p>Here is the image that makes our rounded corners.</p>
<p><a href="http://devinrolsen.com/wp-content/uploads/2009/09/corners.jpg"><img class="alignnone size-full wp-image-253" title="corners" src="http://devinrolsen.com/wp-content/uploads/2009/09/corners.jpg" alt="corners" /></a><strong> </strong></p>
<p><strong>HEY THAT’S NOT A CORNER!</strong></p>
<p>Indeed it&#8217;s not but to save time and memory it’s wise to make a single image that is a circle and is twice, let me repeat that “<strong>TWICE</strong>&#8221; the size of our desired corners.</p>
<p>In this tutorial our corner radius is 20px so we therefore make our circle image 40px wide and 40px tall.</p>
<p>Ok remember how I told you we are going to position our corners to be absolute within our container div box? Well we need to make one more CSS class that will make each of our corners position absolute.</p>
<p>Add the following rule and property&#8217;s to your CSS.</p>
<pre>.corner
{width:20px; height:20px; position:absolute; z-index:1;}</pre>
<p>With this class we are setting each of our corners to have both a width and height of 20px, position to be absolute and have a z-index of 1. Z-index is a way to tell the browser to make our corners priority number one when it comes to a rendering hierarchy. So with z-index:1; our rendering hierarchy will go corners-&gt;content-&gt;container box.</p>
<p>Let’s take a look at our results.</p>
<p><a href="http://devinrolsen.com/wp-content/uploads/2009/09/fig11.jpg"><img class="alignnone size-full wp-image-252" title="fig1" src="http://devinrolsen.com/wp-content/uploads/2009/09/fig11.jpg" alt="fig1" width="353" height="39" /></a></p>
<p>Hmm looks like a long tube of some sorts.Let’s  add some dummy content to it in order to see if our box is stretchy and won’t break if we increase our browsers font size.</p>
<p>Make your HTML look like the following.</p>
<pre>&lt;div class="cell"&gt;
    &lt;ul&gt;
        &lt;li class="tl corner"&gt;&lt;/li&gt;
        &lt;li class="tr corner"&gt;&lt;/li&gt;
        &lt;li&gt;
Nihil eligendi intellegebat et sit, et sit assum aperiam utroque. Augue debitis in sit,
duo an eros saepe saepe "&gt;timeam. Reque erant efficiendi ad vix, nobis saepe mucius no mel. Cu pro diam
probo ne "&gt;convenire, duo ad senserit scripserit philosophia. Admodum commune convenire vix ne, sed
eu tota omnis inani. Odio impetus laoreet usu an, cu tamquam lucilius urbanitas duo, an postea
platonem dissentiet mel.
Qui porro aliquip placerat ei, te eum dicam habemus senserit. Usu an esse saepe efficiantur,
sea at debitis platonem adversarium, in salutatus consequat vix. Altera blandit suscipiantur
ius eu, autem iriure scripserit vix ut, eam ex apeirian postulant. Vis atqui aperiri fuisset ad,
eam te adolescens interesset. Erat iusto propriae pri id, ea sed veri scripta imperdiet.
In quo dicit invidunt intellegam, his vidisse moderatius instructior at, mel dolores consetetur
complectitur eu. Enim utinam voluptatum ad est, no eam iusto integre suscipiantur. Sea cu noster
expetendis suscipiantur, ea mea kasd vidisse patrioque. Tantas feugait suscipit per ad, an quas
soluta latine mei. Iudico discere comprehensam an vix, magna scripserit cu usu, quo eu lucilius
patrioque. Offendit lobortis mea cu, no has essent dolorum molestiae.
His autem verear dolores ex, dolor veniam temporibus eu eos, in amet kasd magna qui.
Mazim equidem adipisci mel an, ea quidam omnium deseruisse est, usu debet facilis abhorreant ex.
Est ea ubique qualisque definitionem, ex ignota commune molestie his, ei est civibus accusam.
An usu dicta praesent partiendo, usu autem persius no, adolescens efficiendi appellantur qui ex.
com cu unum putent ornatus, vel dico nusquam et.
		<strong>&lt;/li&gt;</strong>
        &lt;li class="bl corner"&gt;&lt;/li&gt;
        &lt;li class="br corner"&gt;&lt;/li&gt;
    &lt;/ul&gt;
&lt;/div&gt;</pre>
<p>All content needs to go in between our top corners and our bottom corners and be wrapped in its own list item tag <strong>(&lt;li&gt; &lt;/li&gt;)</strong> in order for it to work correctly with Microsoft IE.</p>
<p>Here is our final results.</p>
<p><a href="http://devinrolsen.com/wp-content/uploads/2009/09/fig21.jpg"><img class="alignnone size-full wp-image-251" title="fig2" src="http://devinrolsen.com/wp-content/uploads/2009/09/fig21.jpg" alt="fig2" width="353" height="238" /></a></p>
<p>Awesome couldn’t ask for more!!</p>
<p>I would like to point out just one more thing that I always thank the CSS gods for and that’s the fact that this whole technique wouldn&#8217;t be possible if we couldn&#8217;t use multiple classes in a single element. Remember our html code I told you to put into your body tags of the document? I would like to point out that all &lt;li&gt; corners are not only using their unique class for top bottom and left right positioning but also our .corner to set all corners dimensions and position:absolute; with one fell swoop to same time and memory again.</p>
<p>That’s it everyone I hope this clears some things up and or inspires people to create some awesome looking designs.</p>
<p><a title="rounded corners demo page" href="http://devinrolsen.com/wp-content/themes/typebased/demos/css/rounded-corners/WORKS.php">Here is a demo of the whole thing if you want to play with it.</a></p>
<p><strong>Thanks.</strong></p>
<p><strong>Devin R. Olsen</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.devinrolsen.com/rounded-corners-with-css-and-one-image/feed/</wfw:commentRss>
		<slash:comments>39</slash:comments>
		</item>
		<item>
		<title>Pure CSS Light Box</title>
		<link>http://www.devinrolsen.com/pure-css-light-box/</link>
		<comments>http://www.devinrolsen.com/pure-css-light-box/#comments</comments>
		<pubDate>Thu, 10 Sep 2009 02:27:48 +0000</pubDate>
		<dc:creator>Devin R. Olsen</dc:creator>
				<category><![CDATA[CSS Tutorials]]></category>
		<category><![CDATA[css lightbox]]></category>
		<category><![CDATA[lightbox]]></category>
		<category><![CDATA[no javascript lightbox]]></category>
		<category><![CDATA[only css lightbox]]></category>
		<category><![CDATA[pure css lightbox]]></category>
		<guid isPermaLink="false">http://devinrolsen.com/?p=75</guid>
		<description><![CDATA[VIEW WORKING EXAMPLE OF OUR PURE CSS LIGHT BOX NOW
A light box is web slang for a way to divide and present such things to your viewers as pictures in a gallery or special site notices. Today I wanted to quickly show you how to create a pure CSS light box. Lets start with our [...]]]></description>
			<content:encoded><![CDATA[<h3><a title="Pure CSS Light Box" href="WORKS.html">VIEW WORKING EXAMPLE OF OUR PURE CSS LIGHT BOX NOW</a></h3>
<p>A light box is web slang for a way to divide and present such things to your viewers as pictures in a gallery or special site notices. Today I wanted to quickly show you how to create a pure CSS light box. Lets start with our light box structure.<br />
Create a new document and add the following:</p>
<pre>
&lt;div class="onLight"&gt;
    On
        &lt;div class="offLight"&gt;Off&lt;/div&gt;
        &lt;div class="lightBox"&gt;&lt;/div&gt;
        &lt;div class="content"&gt;
        &lt;/div&gt;
&lt;/div&gt;</pre>
<p>Here we have a few nested div boxes that make up the structure of our light box. Each division box (div) has a specific class.</p>
<p>We have four elements with the following classes.</p>
<pre>onLight
offLight
lightBox
content</pre>
<p><strong>[onLight]</strong> Any text directly within the onLight class is displayed as the element that turns on the actual light box so this could be anything from pictures to text or whatever.</p>
<p><strong>[offLight]</strong>Anything in the offLight class is what displays as our button to turn off our light box so even this could be images or content.</p>
<p><strong>[lightBox]</strong>Light Box class is purely for structure and style, so always add your light box content within the class “content&#8221;.</p>
<p>Ok I hope I didn’t lose any of you out there I just really wanted to break down the structure so we may get a clear understanding of our CSS that performs all the function behind our pure CSS light box.<br />
With that done let’s move onto our light box’s CSS.</p>
<p>First add the following to the head of your document.</p>
<pre>.onLight {}
.offLight {}
.lightBox {}
.content {}</pre>
<p>Ok let’s break down each rule and their functions before we move onto the style properties that they encompass. We have the following important css rules:</p>
<pre><strong>.onLight {}</strong>
This is the rule that makes up our light box trigger structure.
<strong>.offLight{}</strong>
This is the rule that makes up our light box kill structure.
<strong>.lightBox{}</strong>
This is the rule that makes up our light box background and canvas area.
<strong>.content{}</strong></pre>
<p>This is the rule that makes up our light box’s content area.<br />
Ok now that we have our basic CSS rules let start to populate them with the important style properties and make this light box work.</p>
<p>Make these onLight and offLight classes look like the following:</p>
<pre>
.onLight {padding:2px; width:20px; background:#999; border:#333 solid; border-width:1px;}
.offLight {
    padding:2px;
    z-index:200;
    width:20px;
    background:#999;
    border:#333 solid;
    border-width:1px;
    position:absolute;
    top:535px;
    right:310px;
    display:none;
}</pre>
<p>Our onLight class has styles that help for the purposes of this tutorial make our onLight look like a button. So every style property in this class can be completely customizable to your needs.</p>
<p>Next we have our <strong>offLight</strong> and it too has a majority of styles that meant to make it look like a button. The only very important styles here that we must focus on are the<strong> z-index</strong>, <strong>display</strong> and <strong>position</strong> styles. we use a <strong>position of absolute</strong> to position our <strong>offLite</strong> element anywhere we would like around the actual light box its self.<br />
We also use a <strong>z-index of 200</strong> to make sure its order of rendering hierarchy is high enough to be visible when our light box is active. our last is the <strong>display</strong> style and its set to <strong>none</strong> in order to make sure our <strong>offLight</strong> is not visible until told so.</p>
<p>Ok lets move onto the last two class and their css styles.</p>
<pre>.lightBox {
    width:100%;
    height:100%;
    float:left;
    position:absolute;
    z-index:100;
    background-color:#999999;
    top:0px; left:0px; right:0px; display:none;
    opacity: .80; /*FOR ALL OTHER BROWSERS AND DEVICES*/
    filter: alpha(opacity=80); /*FOR IE7*/
}
.content {
    width: 600px;
    height: 440px;
    border: solid 2px #fff;
    background: #ccc;
    margin-top: 20px auto;
    position:absolute;
    z-index:200;
    top: 30px;
    display:none;
    padding:20px;
}</pre>
<p>Ok there is a lot to break down here so I am only going to cover the important styles and leave the rest up to you the developer to decide.</p>
<p><strong>.lightBox</strong> is set to a width of a 100% and a height of a 100% to take up the whole pages dimensions to create our light box&#8217;s background or rather canvas. we in conjunction of width and height also use a position of absolute to break our light box out of our structured flow to help not destroy our overall structure when the light box is active. We also have a <strong>z-index</strong> of 100 to again give set the order of our rendering hierarchy to be high enough that its layered over our document.</p>
<p>Ok the lightBox rule also has two important rules that are for an opacity CSS feature that makes our light box canvas or rather background transparent. We have to declare our opacity twice, one for IE and another for all other browser. I have my settings set to 80% opaque. There are also additional top and left styles that position our lightBox to start in the upper left hand corner of our document and then proceed onto height and width of a 100%;</p>
<p><strong>.content</strong> again  most of these are set to my preference here for this tutorial so I will only cover the most vital styles. We set a position of <strong>absolute</strong> and <strong>z-index</strong> to our content rule to again position and layered the content box above all other layers. Display is set to none to hide the content element from viewers until told otherwise.</p>
<p>Ok we have just a few more rules that involve some in dept talking in order to give our light box proper functionality. So add these rules to our CSS now.</p>
<pre>.onLight:hover div, .offLight {display:block;}
.offLight:hover + .lightBox {display:none;}</pre>
<p>Our first new rule uses a CSS2 hover pseudo class to control the visibility of our light box upon user interaction with our <strong>.onLight</strong> and <strong>.offLight</strong> elements.<br />
Basically we point to our <strong>.onLight</strong> element and state if its being hovered to locate our <strong>.offLight</strong> element and turn it&#8217;s display none to display block.</p>
<p>Next we are not only using a pseudo hover class but an adjacent sibling selector. We are first pointing to our<br />
<strong>.onLight</strong> element and state that if we hover over it to locate its previous or next sibling element &#8220;<strong>.offLight</strong>&#8221; and turn its display to none.</p>
<p>So think of these last two rules as the on and off functions for our pure CSS light box.</p>
<p>We have one final css rule we must add to help with some browser issues and our height of a 100% in our <strong>.lightBox</strong>.</p>
<p>Add this last rule to our style.</p>
<pre>html,body{height:100%;}</pre>
<p>With this last rule we set both our html document and its body tag to be a height of a 100%. Once you do this any immediately nested element will to be able to use a height of 100%.</p>
<p><strong>NOTE: THIS PURE CSS LIGHT BOX IS ONLY CSS2 COMPATIBLE THEREFOR WORKS ONLY ON IE7+ FF1.0 &#8211; 3.0 AND SAFARI. THIS MEANS THIS METHOD OF LIGHT BOX WILL NOT WORK WITH IE5.5 OR EVEN IE6 WITHOUT THE USE OF JAVASCRIPT. </strong></p>
<p><strong>BECAUSE WE RELY ON THE CSS2 SELECTOR, NOT EVEN A PSEUDO HOVER FIX FOR IE5 AND IE6 WILL FIX THIS METHOD.</strong></p>
<h3><a title="Pure CSS Light Box" href="http://devinrolsen.com/wp-content/themes/typebased/demos/css/css-lightbox/WORKS.html">VIEW WORKING EXAMPLE OF OUR PURE CSS LIGHT BOX NOW</a></h3>
<p><strong>Thanks I hope this helps a few other there.</strong><br />
<strong>Devin R. Olsen</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.devinrolsen.com/pure-css-light-box/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Three Column Layout in less than 15 lines of CSS</title>
		<link>http://www.devinrolsen.com/perfect-three-column-layout/</link>
		<comments>http://www.devinrolsen.com/perfect-three-column-layout/#comments</comments>
		<pubDate>Thu, 10 Sep 2009 02:24:57 +0000</pubDate>
		<dc:creator>Devin R. Olsen</dc:creator>
				<category><![CDATA[CSS Tutorials]]></category>
		<category><![CDATA[css layout]]></category>
		<category><![CDATA[css three coumn]]></category>
		<category><![CDATA[perfect three column]]></category>
		<category><![CDATA[three column]]></category>
		<category><![CDATA[three column layout]]></category>
		<guid isPermaLink="false">http://devinrolsen.com/?p=72</guid>
		<description><![CDATA[This is a  follow-up to my Three Column Layout in less than 10 lines of CSS tutorial but in this one we are going to be using, no background images no JavaScript and 100% pure CSS. This method only uses 14 CSS rules making it very light weight, easy to maintain, SEO and cross [...]]]></description>
			<content:encoded><![CDATA[<p>This is a  follow-up to my <a href="http://www.devinrolsen.com/tutorials/css/three_column_layout/index.php">Three Column Layout in less than 10 lines of CSS</a> tutorial but in this one we are going to be using, no background images no JavaScript and 100% pure CSS. This method only uses 14 CSS rules making it very light weight, easy to maintain, SEO and cross browser friendly. If for what ever reason you feel you might want to use this method but don&#8217;t want to follow the tutorial I have here you can view / build a working demo by going to my:</p>
<p><a title="Thee Column Layout Builder Tool" href="http://devinrolsen.com/wp-content/themes/typebased/demos/css/perfect-three-column-layout/index.html">Thee Column Layout Builder Tool / Live Preview</a></p>
<p>The Three Column Layout Builder Tool is a tool that belongs to a set of tools titled project Mariah I develop to make you the reader&#8217;s life much easier to practice W3C and best practices in web design. Ok let&#8217;s get onto the tutorial for the rest of the readers.</p>
<p>Lets start off with a blank document.</p>
<pre>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/
xhtml1-transitional.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
&lt;title&gt;Untitled Document&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<p>Now in your body tags add the follow html structure. We will start off by breaking down how this structure is layout out and why its important to us before jumping into the CSS.</p>
<pre>&lt;div id="wrap" class="main"&gt;
    &lt;div id="float" class="main float leftRightBdr"&gt;
    &lt;div id="header" class="float topBottomBdr"&gt;
    	&lt;h2&gt;HEADER&lt;/h2&gt;
    &lt;/div&gt;
       &lt;div id="center" class="float leftRightBdr"&gt;
            &lt;!-- <strong>LEFT COLUMN</strong> --&gt;
            &lt;div id="left" class="columns float"&gt;
            &lt;/div&gt;
            &lt;!-- <strong>RIGHT COLUMN</strong> --&gt;
            &lt;div id="right" class="columns"&gt;
            &lt;/div&gt;
            &lt;!-- <strong>CENTER COLUMN CONTENT CELL</strong> --&gt;
            &lt;div class="content" id="content"&gt;
            &lt;/div&gt;
		   &lt;/div&gt;
        &lt;div id="footer" class="float topBottomBdr"&gt;
            Footer
        &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;</pre>
<p>Take a look at our first main containing div that we have given  an id of &#8220;<strong>wrap</strong>&#8221; and a class of &#8220;<strong>main</strong>&#8220;. We use a main container or &#8220;wrapper&#8221; block around our entire layout to align the whole layout to our documents center. Next we have another containing div box with our first that has and id of &#8220;<strong>float</strong>&#8221; and class of &#8220;<strong>float</strong>&#8220;. We use this second container or &#8220;wrapper&#8221; block around our layout as well to allow a layout align of center but also support div block floating ability&#8217;s.</p>
<p>Next we have a div block with an id of &#8220;<strong>header</strong>&#8221; and this is the location of our layouts header information. There is also a div block with an id of &#8220;<strong>footer</strong>&#8221; down below and this is the location of our footer information. Between the &#8220;header&#8221; and &#8220;footer&#8221; blocks is a third block that has an id of &#8220;center&#8221;. The &#8220;<strong>center</strong>&#8221; block acts as another container or &#8220;wrapper&#8221; for our three columns (<strong>content, left and right</strong>).</p>
<p>The first div block listed in our &#8220;<strong>center</strong>&#8221; block is a block with a class of &#8220;<strong>content</strong>&#8220;. Next is the div block with the id of &#8220;<strong>left</strong>&#8221; and last we have our last div block with the id of &#8220;<strong>right</strong>&#8220;. The &#8220;<strong>content</strong>&#8221; div block is indeed our location for where we want our center columns information to be stored so don&#8217;t let the names throw you off.</p>
<p><img src="http://www.devinrolsen.com/tutorials/css/perfect_three_column_layout/images/fig1.jpg" alt="Perfect three column layout" /></p>
<p>Ok lets take a look at our CSS structure. Add the following to your header tags.</p>
<pre>&lt;style type="text/css"&gt;
&lt;/style&gt;</pre>
<p>In between these tags add the following css class rules.</p>
<pre>body          {text-align:center;}
.main         {width:980px !important; width:982px;}
.columns      {width:145px; float:left; padding:10px; position:relative; z-index:100; overflow:auto;}
.float        {float:left; display:inline;}
.topBottomBdr {border:#000 solid; border-width:0px "&gt;1px "&gt;0px "&gt;1px 0px 1px 0px;}
.leftRightBdr {border:#000 solid; border-width:0px "&gt;1px "&gt;0px 1px 0px 1px;}
.content      {margin:15px;}</pre>
<blockquote>
<ul>
<li>Our first rule here is our body tag and its declaring a text-align of center. We set our body to be a text-align of center to fix IE5 and IE6 issues with the use of margin floats to center our layout to our document.</li>
<li>Our second rule is .main and has a width of 980px and we again set this width to make our layout compatible with the standard screen resolution of 1024&#215;768. You will notice that we have used something called <strong>!important</strong> here. If you don&#8217;t know what <strong>!important</strong> is I suggest you <a title="The !important use in css" href="http://www.devinrolsen.com/tutorials/css/the-important-use-in-css/index.php" target="_blank">read this quick break down on how it helps</a> us the developers. Just note that we use two widths here and the <strong>!important</strong> to isolate IE6 and below who have problems with extra width totals because of borders.</li>
<li>Our Third rule is called .columns. Here we have set our width to be 145px (the amount of our desired left and right column width minus the 10px padding in both columns). We have set the float to be that of left and a padding of 10px, position of relative, z-index of 100 and an overflow of auto. We set our float to be left to abide by the rest of our layouts flow and our desired results. A padding of 10px is added to give cushion between our content and our div column walls. The position is set to relative to give allow use to work with our z-index style.The z-index style is a way to order our browsers rendering hierarchy and there for our columns are always on top. Our last style is the overflow rule and we set it to auto and this leave it up to our browser to decide if a hidden or scroll action should be taken place. With overflow auto if our left and right columns are shorter than the content will allow the browser will take action.</li>
<li>Our fourth rule is named .float and this rule give a float of left to the rest of our columns but also has a display of inline to make our float compatible with IE6.</li>
<li>The fifth and sixth rule are of preference and are our borders to divide up our columns footer and header div blocks from one another. topBottomBdr =Top Bottom Border while leftRightBdr = Left Right Border.</li>
<li>Our last CSS rule is named .content and it has a margin of 15px in order to give our center column a padding between its content and div blocks walls. We also use a position of absolute and top 0px to override our content block from pushing our left and right column below its desired content amount.</li>
</ul>
</blockquote>
<p>Wow that was a lot&#8230; are you ready to move on? Ok add these last CSS id rule to our CSS style tags in your documents header.</p>
<pre>#wrap   {margin-left:auto; margin-right:auto; text-align:left;}
#float  {background-color:#CCC;}
#center {margin-left:165px; margin-right:165px; width:650px<strong>!important</strong>; width:; background-color:#FFF; position:relative;}
#left   {margin-left:-164px;}
#right  {margin-right:-164px; float:right;}
#header {width:100%; height:100px; background-color:#FFF;}
#footer {width:100%; height:20px; background-color:#FFF;}</pre>
<p>Ok here we have our last seven css rules so let break down these last few.</p>
<blockquote>
<ul>
<li>Our first CSS rule is named #wrap and is the id for our main div block. Its margin-left and margin-right is set to auto to align our layout to the center of our document but also used over (<strong>margin:auto;</strong>) to fix IE6 centering issues. We also set its text-align to be left in order to override our body text-align center fix.</li>
<li>Our next CSS rule is for our next container div block called #float. Here we set its background color to be what ever we prefer resulting in changing our left and right columns color.</li>
<li>Next is the #center CSS rule that also has a margin-left and margin-right but these are set to the desired width of our columns with are compensating for our left and right columns padding of 10px. The width is set to be that of 650px because our over all layout width (980px) minus our desired column width (165px) x 2 columns = 650px. (<em style="text-decoration:underline;">Notice that we again use the !important procedure to fix IE6 issues.</em>) Finally we set its background-color to be that of #fff(white) in order to differ our center columns background color from our columns background color. Because #center is our parent container for our .content div block that uses a position of absolute we must then give our #center a position of relative in order to make sure our .content block doesnt break our of our layouts flow and structured order.</li>
<li>Next we have the #left rule and #right rule. Our #left rule has a margin-left of -164px and we do this to offset the left column by the desired column widths from our center div block plus the 1px for our left and right borders. For our right column we again offset our right column by its desired width but this time we use a margin-right style. In our #right rule we have also broken our right column out of our layouts flow by using the float right style.</li>
<li>Next is our #header and #footer rules and these are up to you the developer as the only state widths, heights and background colors.</li>
</ul>
</blockquote>
<p>Guess what folks, you have just created thee perfect 100% pure light weight cross browser friendly CSS three column layout. If you would like to see the results of our labor click the link below to see a working example / layout builder tool.</p>
<p>I hope this help many of my readers and also inspires people to create some awesome designs.</p>
<p><a title="Thee Column Layout Builder Tool" href="http://devinrolsen.com/wp-content/themes/typebased/demos/css/perfect-three-column-layout/index.html">Thee Column Layout Builder Tool / Live Preview</a></p>
<p><strong>Devin R. Olsen</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.devinrolsen.com/perfect-three-column-layout/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Learning Intermediate CSS Faster Than Ever.</title>
		<link>http://www.devinrolsen.com/learning-intermediate-css/</link>
		<comments>http://www.devinrolsen.com/learning-intermediate-css/#comments</comments>
		<pubDate>Thu, 10 Sep 2009 02:20:17 +0000</pubDate>
		<dc:creator>Devin R. Olsen</dc:creator>
				<category><![CDATA[CSS Tutorials]]></category>
		<guid isPermaLink="false">http://devinrolsen.com/?p=69</guid>
		<description><![CDATA[Today we will be expanding on our previous tutorial &#8220;Learning the basics of CSS faster than ever&#8221; into what areas we are permitted to write our CSS. There are  three areas we are permitted to write CSS and these are.
Combining Rules -
Selectors -
Pseudo Class -
Inline
We talked about how to write inline styles in our [...]]]></description>
			<content:encoded><![CDATA[<p>Today we will be expanding on our previous tutorial &#8220;<a title="Learning the basics of CSS faster than ever" href="http://www.devinrolsen.com/tutorials/css/learn_basics_css/index.php">Learning the basics of CSS faster than ever</a>&#8221; into what areas we are permitted to write our CSS. There are  three areas we are permitted to write CSS and these are.</p>
<div style="position:relative;"><strong>Combining Rules -</strong><br />
<strong>Selectors -</strong><br />
<strong>Pseudo Class -</strong></div>
<h2>Inline</h2>
<p>We talked about how to write inline styles in our last tutorial. We even discussed how even though it’s possible and sometime necessary, it’s not always wise to clutter you document elements with inline styles. Writing inline CSS styles or rather writing styles directly into the elements  is not only going against what we are trying to accomplish with CSS, but the styles are only downloaded on a per-page basis.</p>
<p>This means that if you write all your document element styles inline then they are never truly being cached in a visitor’s browser. Each page will only load that much slower depending on how many styles you have in your documents elements.</p>
<p><strong>More inline styles = more page loading time on a per-page basis</strong></p>
<p><strong>More inline styles = a step backwards in the CSS mind frame</strong></p>
<p>You may be asking yourself &#8220;Well why then do we have the ability to write styles inline?&#8221; The answer to this is simple, sometimes you have to override a decelerated CSS rule from one of the two other areas we are going to be talking about.</p>
<p>You may be asking yourself &#8220;Why would I want to override a decelerated CSS rule?&#8221; Sometimes you run into a situation where you have a style rule that cascades down over ever page for a particular element or two.  Then lets say on one particular page you might need to have these two elements be slightly different from the rest of the pages. You would then write these styles inline in order to take control of these two elements on this particular page. Because inline styles is that last reading point for our browsers all inline styles override any previous decelerated CSS rule. Hence inline styles per-page basis idealism.</p>
<p>So there is a need for inline styling, but for only special situations. Only use inline styling for special situations such as this and never abuse them.</p>
<p>Ok everyone clear why we have CSS inline styling and how not to abuse it? Perfect let’s move onto our header area.</p>
<h2>Header</h2>
<p>Every html document has a header (<strong>&lt;head&gt;&lt;/head&gt;</strong>) but did you know you can write CSS styles in your documents header? All you need is to open up a space where you would want to write your CSS  with &#8220;style tags&#8221;.</p>
<pre>&lt;style type="text/css"&gt;
&lt;/style&gt;</pre>
<p>These are style tags and it’s a way to tell the browsers that this area contains CSS. Like I said your style tags belong in your header tags like so:</p>
<pre>&lt;head&gt;
&lt;style type="text/css"&gt;
&lt;/style&gt;
&lt;/head&gt;</pre>
<p>There are two questions you should now be asking yourself about these style tags.</p>
<p><strong>Are style tags just like inline styles in that they too are a per-page basis method?</strong></p>
<p><strong>Will the number of styles you have in your style tags also affect your pages loading time?</strong></p>
<p>Answer to these two questions is yes. You may be wondering &#8220;What’s the difference between inline styling and writing your styles in the header?&#8221; At first it might be confusing about what the difference between inline style and style tags but actually there is one huge difference. In style tags you have the ability to use classes and id’s,  where as inline styling you don’t.</p>
<p>Imagine with me if you will that again we have 50 images on a page and each image looks like this:</p>
<pre>&lt;img src="image.jpg" style="width:100px; height:100px border:#000 solid thin;" /&gt;</pre>
<p>If we simply take these style out of all 50 images and replace them with:</p>
<pre>&lt;img src="image.jpg" class="myImages" /&gt;</pre>
<p>We could then sum up all them styles into one class rule thats named &#8220;<strong>.myImages</strong>&#8221; in our style tags like so:</p>
<pre>&lt;style type="text/css"&gt;
.myImages {width:100px;  height:100px; border:#000 solid thin;}
&lt;/style&gt;</pre>
<p>See the big difference between writing inline style and writing in your documents header? With style tags you can begin to sum up all the inline styles  into rules that can then be cascaded down this single document.</p>
<p>Again if you have a style that is being cascaded down your entire site but then have a few pages that you need to slightly look different from the rest. You could then write your style rules in your headers style tags and apply them to your elements accordingly instead of having to write so many inline styles.</p>
<p>Awesome&#8230; right?</p>
<p>Everyone clear that we use inline styles to overwrite existing declared style rules. Everyone understand that we use header style tags to help cut down inline style and to help our inline styles mission of overriding existing style rules? superb, let’s move onto our last  permitted location of CSS.</p>
<h2>External</h2>
<p>I just used the words &#8220;Permitted location&#8221; and the keyword here is location. Our last area of permitted CSS is the external CSS file. Ah yes the external CSS file the one and true way to cascade rules over your entire site. Up till now you might have heard me mention how inline styling and style tags are for overriding an already declared CSS rule. These pre-existing rules I was talking about only come from the external CSS file. So the chain of command for who overrides what goes as follows.</p>
<p><strong>External CSS file get downloaded first therefor gets overridden by both inline and style tags.</strong></p>
<p><strong>Style Tags rules get downloaded second and only get overridden by inline styles.</strong></p>
<p><strong>Inline Styles don’t get overridden by any of the above.</strong></p>
<p>Perfect let’s take a look at what’s required to bring an external CSS file to our document. In each of our documents header that we wish to link our external CSS file too we must include a &lt;link /&gt;<br />
link tag. Here is a link tag for linking CSS files into a document.</p>
<pre>&lt;link href="css/styles.css" rel="stylesheet" type="text/css" /&gt;</pre>
<p>This element has three important attributes. The first is &#8220;href&#8221; and this is the location of our CSS file on our web server. You can have a relative path to your CSS file like this:</p>
<pre>href="../../css/styles.css"</pre>
<p>Or an absolute path to your CSS file like this:</p>
<pre>href="http://www.mywebsite.com/css/styles.css"</pre>
<p>Ok the second attribute is the <strong>rel=&#8221;stylesheet&#8221;</strong> and this lets our browser know that it needs to download this style sheet first before the rest of our style.<br />
Our last attribute tells the browser that this external file is of made up of text and CSS.<br />
All three of these attributes are required to perform as correct external style sheet link.</p>
<p>Ok so let recap here.</p>
<p>Inline styles are to perform an override of external file css rules for a special situation.<br />
Style tags are to help assist inline styles by allow us to sum up a great number of would be inline styles.<br />
External CSS files is the one and only true way to cascade your site&#8217;s style over every page.</p>
<p>Well everyone I think that just about wraps it up for this lesson. I hope this helps everyone to grasp a little bit more on how to   use CSS effectively.</p>
<p>Next we will be finishing up our series and discussing advance css.</p>
<p>Thanks everyone.</p>
<p>Devin R. Olsen</p>
]]></content:encoded>
			<wfw:commentRss>http://www.devinrolsen.com/learning-intermediate-css/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>
