 <?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>Sat, 14 Jan 2012 02:25:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Combat Extreme &#8211; Facebook 3D Shooter</title>
		<link>http://www.devinrolsen.com/combat-extreme-facebook-3d-shooter-video-game/</link>
		<comments>http://www.devinrolsen.com/combat-extreme-facebook-3d-shooter-video-game/#comments</comments>
		<pubDate>Mon, 05 Dec 2011 17:48:49 +0000</pubDate>
		<dc:creator>Devin R. Olsen</dc:creator>
				<category><![CDATA[3D Tutorials]]></category>
		<category><![CDATA[Ajax Tutorials]]></category>
		<category><![CDATA[CSS Tutorials]]></category>
		<category><![CDATA[Featured Articles]]></category>
		<category><![CDATA[General Web Development]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[JavaScript Tutorials]]></category>
		<category><![CDATA[Magento Tutorials]]></category>
		<category><![CDATA[PHP Tutorials]]></category>
		<category><![CDATA[SEO Tutorials]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[3d combat facebook]]></category>
		<category><![CDATA[3d combat game]]></category>
		<category><![CDATA[3d facebook game]]></category>
		<category><![CDATA[combat]]></category>
		<category><![CDATA[combat 3d game]]></category>
		<category><![CDATA[combat extreme]]></category>
		<category><![CDATA[extreme]]></category>
		<category><![CDATA[extreme combat facebook game]]></category>
		<category><![CDATA[extreme combat game facebook]]></category>
		<category><![CDATA[facebook 3d combat game]]></category>
		<category><![CDATA[facebook 3d game]]></category>
		<category><![CDATA[facebook combat video game]]></category>
		<category><![CDATA[facebook shooter]]></category>
		<category><![CDATA[game]]></category>
		<category><![CDATA[shooter game]]></category>
		<category><![CDATA[third-person]]></category>
		<category><![CDATA[video game]]></category>

		<guid isPermaLink="false">http://www.devinrolsen.com/?p=1541</guid>
		<description><![CDATA[My little brother and I have been working on this third-person shooter video game together for well over a year now, come check it out and play for free through your web browser!]]></description>
			<content:encoded><![CDATA[<p>Hi readers! I thought I would take a different pace today, and instead of teaching lets play some games shall we? For over a year now I and my little brother have been working tirelessly on our first &#8220;Third-person shooter&#8221; video game.</p>
<p><iframe src="http://www.youtube.com/embed/rhx_eJxyRv8" frameborder="0" width="420" height="315"></iframe></p>
<p><strong><a title="Combat Extreme - Third-person shooter on Facebook.com" href="https://www.combat-extreme.com/">CLICK HERE TO START PLAYING OUR GAME!</a></strong></p>
<p>So what makes this game so different you ask? Well the game is completely browser-based. That&#8217;s right, a full 3D environment third person shooting game that is playable through your web browser!</p>
<p>It&#8217;s a simple game of Marines vs. Insurgents based in a mideast town (for the BETA at least, we have three total levels for full release of the video game).</p>
<p>We used the Unity3d game engine to develop this game, and although our game is still in a official &#8220;BETA&#8221; title, I felt it was finally time to share this awesome work with the rest of my readers and the world.</p>
<p>In order to play Combat Extreme (the 3d third-person shooter) on Facebook through your web browser, you must have the unity3d web player installed. The web player is designed specifically to render geometry and post process effects directly through ones browsers (Yes even IE).</p>
<p>Combat Extreme (the 3d third-person shooter) is indeed exclusive to facebook.com right now and may or may not be opened to further social gaming markets. We really wanted to create a seamless experience for our UX, and insisting the user create a new account with an email address conformation + allow the app on their page was asking way too much. Thus, we eliminated the biggest step and allow our users to login to Combat Extreme (the 3d third-person shooter game) through their facebook account.</p>
<p><strong><a title="Combat Extreme - Third-person shooter on Facebook.com" href="https://www.combat-extreme.com/">CLICK HERE TO START PLAYING OUR GAME!</a></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.devinrolsen.com/combat-extreme-facebook-3d-shooter-video-game/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Two Element CSS Selector Challenge</title>
		<link>http://www.devinrolsen.com/two-element-css-selector-challenge/</link>
		<comments>http://www.devinrolsen.com/two-element-css-selector-challenge/#comments</comments>
		<pubDate>Tue, 31 May 2011 01:11:50 +0000</pubDate>
		<dc:creator>Devin R. Olsen</dc:creator>
				<category><![CDATA[CSS Tutorials]]></category>
		<category><![CDATA[Featured Articles]]></category>
		<category><![CDATA[challenge]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[CSS Challenge]]></category>
		<category><![CDATA[CSS selector]]></category>
		<category><![CDATA[css selector challenge]]></category>
		<category><![CDATA[CSS selectors]]></category>
		<category><![CDATA[css two selectors]]></category>
		<category><![CDATA[elements]]></category>
		<category><![CDATA[selector]]></category>
		<category><![CDATA[selectors]]></category>
		<category><![CDATA[short]]></category>
		<category><![CDATA[short css selectors]]></category>
		<category><![CDATA[short selector]]></category>
		<category><![CDATA[short selectors]]></category>
		<category><![CDATA[small]]></category>
		<category><![CDATA[small css selectors]]></category>
		<category><![CDATA[small selector]]></category>
		<category><![CDATA[small selectors]]></category>
		<category><![CDATA[smaller]]></category>
		<category><![CDATA[two]]></category>
		<category><![CDATA[two css selectors]]></category>
		<category><![CDATA[two element selector]]></category>
		<category><![CDATA[two element selectors]]></category>
		<category><![CDATA[two elements]]></category>

		<guid isPermaLink="false">http://www.devinrolsen.com/?p=1237</guid>
		<description><![CDATA[A while ago I was asked by a follow co-worker if I think it was possible to build an entire site using only two CSS selectors. So after better defining, then adopting the challenge, I felt it was time to share. With this challenge, you push your thinking in a more minimalistic frame of mind with little impact and/or no learning curve.]]></description>
			<content:encoded><![CDATA[<h2>Introduction to a challenge</h2>
<p>A while ago I was asked by a follow co-worker if I think it was possible to build an entire site using only two elements in my CSS selectors. Now I must admit, at the time I found the whole idea to be kinda crazy, however the more I got to thinking about it the more I started to love the challenge. So after better defining, then adopting the challenge, I felt it was time to share this code game with everyone.</p>
<div id="attachment_1309" class="wp-caption alignright" style="width: 160px"><a href="http://www.devinrolsen.com/wp-content/themes/dolsen/_resources/css/global.css"><img class="size-thumbnail wp-image-1309 " title="document-code" src="http://www.devinrolsen.com/wp-content/uploads/2011/05/document-code-150x150.jpg" alt="" width="150" height="150" /></a><p class="wp-caption-text">Take a look at this very site&#39;s own style sheet that passes this two selector challenge</p></div>
<p>As most know, it&#8217;s always a good idea keep your CSS selectors slim to help the browser performance. With more and more complex sites however, there seems to be a trend of writing code that just works, and not code that works to the best of its ability.</p>
<p>When browsers read our style sheets, they do so by traversing our markup DOM through the selectors we feed it, then it applies our styles to that element or elements. The longer our selectors are, the more work the browser has to do to locate that element or elements.</p>
<p>Selector lengths may seem trivial at first. However if you multiply that long selector against the size of your style sheet, you can see this how this would impact a site&#8217;s performance. By cutting down the length of elements in our selector we help the browser parse through our style sheets faster. Not only does using shorter selectors help with performance, but also helps with organization and legibility for you the developer.</p>
<p>With the two element CSS selector challenge, you push your thinking in a more minimalistic frame of mind with little impact and/or no learning curve.</p>
<h2>The Rules:</h2>
<p>There is really only one rule at this time, and that&#8217;s to never ever exceed more than two elements in your CSS selectors. You may use pseudo, child, adjacent and element attributes in your selectors still, because this does not violate our rule of exceeding two elements.</p>
<h3>Examples of valid two element selectors:</h3>
<pre>li a { .. }

#header #nav { .. }
#nav li { .. }
#nav .active { .. }

.active a { .. }
.active .active { .. }
.category #nav { .. }

li.active a { .. }
li.active a.active { .. }

#nav &gt; li { .. }
li.current + li { .. }
form input[type="text"] { .. }

#nav li,
li.active a,
li.active a.active { .. }</pre>
<p>These are all valid and only using two elements, even if we point to an element and it&#8217;s attribute as well.</p>
<h3>What is not a valid two element selector?</h3>
<pre>ol li a { ... }
#nav li a { ... }
#nav .active a { ... }
#nav li.active a.active { ... }

#nav &gt; li a { .. }
li.current + li a{ .. }
form li input[type="text"]</pre>
<p>These are not valid because they simply exceed the &#8220;two elements only&#8221; rule.</p>
<p>When I first picked up this challenge I was really amazed at how natural it was for me to write selectors longer than two elements. During my challenge, I was faced with lots of little instances that really made me rethink my selector approach.</p>
<p>If you indeed try to pick up this challenge, the best advice I can give you is to not be afraid to use more classes in your markup. I found that whenever I was faced with a really tough instance, adding an additional class to my markup was always the best solution.</p>
<p>Over time, I fully adopted this challenge into my everyday practice and now it flows like second nature. So I can promise you, with just a little effort and almost no learning curve, you can drastically improved your style sheets performance and organization.</p>
<h3><a title="Your first two selector challenge" href="http://jsfiddle.net/yQ8Dw/">&gt;&gt; Click here to start your first two selector challenge</a></h3>
<p>Your first challenge is to take this markup and make a proper CSS layout for it using only two elements in your selectors. Once you have completed the challenge, share your link with me here in the comments below and tell me a little about your challenge experience.</p>
<p>Special thanks to <a title="Paul Farning (Orignal creator of this challenge)" href="http://www.waytoocrowded.com/">Paul Farning</a> and <a title="Fellow coworker who told me about the challenge." href="http://christophsaxe.com/">Christoph Saxe</a> for bringing this most excellent challenge to life!</p>
<p>Devin R. Olsen</p>
]]></content:encoded>
			<wfw:commentRss>http://www.devinrolsen.com/two-element-css-selector-challenge/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Working With CSS Sprites</title>
		<link>http://www.devinrolsen.com/beginners-guide-to-css-sprites/</link>
		<comments>http://www.devinrolsen.com/beginners-guide-to-css-sprites/#comments</comments>
		<pubDate>Tue, 31 May 2011 01:05:36 +0000</pubDate>
		<dc:creator>Devin R. Olsen</dc:creator>
				<category><![CDATA[CSS Tutorials]]></category>
		<category><![CDATA[Featured Articles]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[css sprite]]></category>
		<category><![CDATA[css sprite tutorial]]></category>
		<category><![CDATA[css sprites]]></category>
		<category><![CDATA[css sprites tutorial]]></category>
		<category><![CDATA[global]]></category>
		<category><![CDATA[global sprite]]></category>
		<category><![CDATA[learning]]></category>
		<category><![CDATA[learning css sprites]]></category>
		<category><![CDATA[learning sprites]]></category>
		<category><![CDATA[specific]]></category>
		<category><![CDATA[specific sprite]]></category>
		<category><![CDATA[specific sprites]]></category>
		<category><![CDATA[sprite]]></category>
		<category><![CDATA[sprite css]]></category>
		<category><![CDATA[sprite tutorial]]></category>
		<category><![CDATA[sprites]]></category>
		<category><![CDATA[sprites tutorial]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.devinrolsen.com/?p=1286</guid>
		<description><![CDATA[Sprites are compiled versions of different creative parts of a website that typically has no need for repeating axises. Sprites are recommended to be used when ever possible to help cut down on HTTP requests to the server, and ultimately help speed up the performance of your web site.]]></description>
			<content:encoded><![CDATA[<h2>What is a CSS Sprite anyways?</h2>
<p>Sprites are compiled versions of different creative parts of a website that typically has no need for repeating axises. Sprites are recommended to be used when ever possible to help cut down on HTTP requests to the server, and ultimately help speed up the performance of your website.</p>
<p>You should never include creative into a sprite that is page or content specific, or will need to be frequently updated. You absolutely can&#8217;t add creative that needs to be repeated on both the x and y value. You can however add creative that needs to be repeated by a single x or y axis, but only if you prepare the sprite so it indeed repeats from edge to edge of that sprites axis.</p>
<p>When thinking about how to organize my sprites, I tend to group everything into two parties:</p>
<ul>
<li>A global look and feel sprite.</li>
<li>All other specific Case Scenarios sprites.</li>
</ul>
<p>A global sprite is made up of all large site wide repeating creative parts (such as header and footer contents) that are compiled into a single image. Whereas specific case scenario sprites (such as custom buttons and their events) are on their own and should never be included into the global sprite. Again, we define this clear division based on the likely hood of the sprite ever needing to be update or changed at a later point.</p>
<p>Lets take a look at a global site sprite:</p>
<div id="attachment_1287" class="wp-caption aligncenter" style="width: 565px"><a href="http://www.devinrolsen.com/wp-content/uploads/2011/05/site-sprite.png"><img class="size-large wp-image-1287" title="site-sprite" src="http://www.devinrolsen.com/wp-content/uploads/2011/05/site-sprite-1024x336.png" alt="" width="555" height="182" /></a><p class="wp-caption-text">A global site sprite.</p></div>
<p>As you can see in the above sprite, we have most of the sites global creative components compiled into a single image. We even at the bottom of the above sprite have a perfect example of a creative part needing to be repeatable in (in this example the x axis) a single axis. Elements such as buttons that have different event states (hover,clicked or disabled) should always be a sprite no matter what, but again never added to this global sprite.</p>
<div id="attachment_1317" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.devinrolsen.com/wp-content/uploads/2011/05/btn_blue_sprite.gif"><img class="size-medium wp-image-1317" title="btn_blue_sprite" src="http://www.devinrolsen.com/wp-content/uploads/2011/05/btn_blue_sprite-300x131.gif" alt="" width="300" height="131" /></a><p class="wp-caption-text">A button sprite, see how it&#39;s setup to be used on a sliding door technique and has two event states.</p></div>
<p>Now that we have a good understanding of the requirements and organization or sprites, lets to dig into the CSS concepts of using our sprites with our site elements. You have two methods to set your sprites as background on elements with CSS, and they are:</p>
<ul>
<li>background</li>
<li>background-image</li>
</ul>
<p>Here are examples of these two background setting methods:</p>
<pre>#element{
    <strong>background</strong>:url("../sprite.png") x y no-repeat;
}</pre>
<p>The above is the short hand version of setting the background image,  x y positions (typically pixel values) and if the background should be repeatable or not. Again, with sprites you will only ever be using either no-repeat, repeat-x or repeat-y.</p>
<pre>.element-one,.element-two {
    <strong>background-image</strong>:url("../sprite.png");
    background-repeat:no-repeat;
}

.element-one { background-position:x y; }
.element-two { background-position:x y; }</pre>
<p>The above version makes use of the long hand version to set the sprite over two elements, make it not repeatable and then give two unique axis position values over the two elements.</p>
<p>As stated above, you may set the position values in pixel, but you can also position words as well:</p>
<pre>.element-one { background-position:0 0; }
.element-two { background-position:right bottom; }</pre>
<p>In the above example &#8220;.element-one&#8221; gets a very specific pixel x and y axis value(equals top left). Our &#8220;.element-two&#8221; however, just states its x and y values by using top, right, bottom or left words. This really comes in handy when you have the need to position the sprite to element constantly to the top, right, bottom or left, under any width or height variants.</p>
<p>As mentioned a few times now, buttons that have different creative states should be compiled into their own sprite. You can then use such things as the CSS pseudo hover selector to change between different creative states like so:</p>
<pre>.element-two:hover { background-position:right top; }</pre>
<p>You can also have &#8220;conditional&#8221; classes that change the sprites background-position over your elements with help of JavaScript, like so:</p>
<pre>.element-one,.element-two {
    background-image:url("../sprite.png");
    background-repeat:no-repeat;
}

/*The Conditional Classes*/
.on { background-position:left top; }
.off { background-position:left bottom;}

//jQuery code
$('.element-one,.element-two').toggle(function(){
$(this).removeClass('off').addClass('on');
},function(){
$(this).removeClass('on').addClass('off');
});</pre>
<p>We set our sprite to the background of our two elements (.element-one, .element-two) and then change the background-position through the on and off classes. Next we use a little jQuery to toggle the adding and removing of our on and off classes over our two elements when ever they happen to be clicked.</p>
<p>Here is an advanced example of using a simple sprite with CSS and JavaScript:</p>
<ul id="sprite">
<li><a href="#">Hover, then click me:</a>
<ul class="sub-sprite">
<li>
<div class="content">
<h2>Header to the content 1</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. In luctus lacinia aliquam. Donec risus nisi, lacinia nec aliquet vitae, vehicula a quam. Phasellus ornare tempor neque, in laoreet urna eleifend a. Praesent id justo quis mi elementum adipiscing. Maecenas risus velit, fermentum at scelerisque ut, faucibus ac tortor.<a class="close" href="#"></a></p>
</div>
</li>
</ul>
</li>
<li><a href="#">Hover, then click me:</a>
<ul class="sub-sprite">
<li>
<div class="content">
<h2>Header to the content 2</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. In luctus lacinia aliquam. Donec risus nisi, lacinia nec aliquet vitae, vehicula a quam. Phasellus ornare tempor neque, in laoreet urna eleifend a. Praesent id justo quis mi elementum adipiscing. Maecenas risus velit, fermentum at scelerisque ut, faucibus ac tortor.<a class="close" href="#"></a></p>
</div>
</li>
</ul>
</li>
<li><a href="#">Hover, then click me:</a>
<ul class="sub-sprite">
<li>
<div class="content">
<h2>Header to the content 3</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. In luctus lacinia aliquam. Donec risus nisi, lacinia nec aliquet vitae, vehicula a quam. Phasellus ornare tempor neque, in laoreet urna eleifend a. Praesent id justo quis mi elementum adipiscing. Maecenas risus velit, fermentum at scelerisque ut, faucibus ac tortor.<a class="close" href="#"></a></p>
</div>
</li>
</ul>
</li>
<li><a href="#">Hover, then click me:</a>
<ul class="sub-sprite">
<li>
<div class="content">
<h2>Header to the content 4</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. In luctus lacinia aliquam. Donec risus nisi, lacinia nec aliquet vitae, vehicula a quam. Phasellus ornare tempor neque, in laoreet urna eleifend a. Praesent id justo quis mi elementum adipiscing. Maecenas risus velit, fermentum at scelerisque ut, faucibus ac tortor.<a class="close" href="#"></a></p>
</div>
</li>
</ul>
</li>
</ul>
<p><strong><a title="sprite example's files" href="http://jsfiddle.net/s5Rfm/">&gt;&gt; Click Here for Above Example&#8217;s Code</a></strong><br />
<strong><a title="sprite example's sprite image" href="/wp-content/themes/dolsen/demos/css/css-sprites/img/site-sprite-demo.png">&gt;&gt; Click Here for Above Example&#8217;s Sprite</a></strong></p>
<h2>Final Thoughts</h2>
<p>Lastly, because our sprites make use of some very specific x and y pixel or word based positioning, it&#8217;s very important that you update sprites with extreme caution. A slight addition or subtraction to a sprite&#8217;s creative location or overall dimensions means having to fix all your CSS position values. So I say it again, we make a clear division between global sprite and specific case scenarios based off the likely hood of the sprite ever needing to be updated.</p>
<p>And that&#8217;s it, I hope this little article helps a few people gather what they need in order to create great site sprites.</p>
<p>Thanks everyone.</p>
<p>Devin R. Olsen</p>
]]></content:encoded>
			<wfw:commentRss>http://www.devinrolsen.com/beginners-guide-to-css-sprites/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Fix Collapsing Elements With Floating Children</title>
		<link>http://www.devinrolsen.com/fix-collapsing-elements-with-floating-childen/</link>
		<comments>http://www.devinrolsen.com/fix-collapsing-elements-with-floating-childen/#comments</comments>
		<pubDate>Sat, 18 Sep 2010 06:03:59 +0000</pubDate>
		<dc:creator>Devin R. Olsen</dc:creator>
				<category><![CDATA[CSS Tutorials]]></category>
		<category><![CDATA[children]]></category>
		<category><![CDATA[collapsed]]></category>
		<category><![CDATA[collapsed element]]></category>
		<category><![CDATA[collapsed parent element]]></category>
		<category><![CDATA[collapsing]]></category>
		<category><![CDATA[collapsing elements]]></category>
		<category><![CDATA[collapsing parent]]></category>
		<category><![CDATA[element]]></category>
		<category><![CDATA[float]]></category>
		<category><![CDATA[floated]]></category>
		<category><![CDATA[floated children]]></category>
		<category><![CDATA[floated children problem]]></category>
		<category><![CDATA[floating]]></category>
		<category><![CDATA[floating child]]></category>
		<category><![CDATA[floating children]]></category>

		<guid isPermaLink="false">http://www.devinrolsen.com/?p=911</guid>
		<description><![CDATA[Today we are going to talk about how to un-collapse them parent elements of floating children.  How many times have you had an element collapse or rather disappear from sight when its children element are using a CSS float styles?]]></description>
			<content:encoded><![CDATA[<p>Today we are going to talk about how to un-collapse them parent elements of floating children.  How many times have you had an element collapse or rather disappear from sight when its children element are using a CSS float style?</p>
<p>The problem is sometimes you have a parent element whose styles such as background image or borders are important to your design, yet it gets collapsed when its immediate children elements are floated. One way to fix this was to float the parent element as well, but this was a bad idea for two reasons.</p>
<p>One reason why bubbling up the float to the parents is not good is the fact that it means you are using a float style in more places than is required. Another good reason why bubbling up floats is bad, is that some times you want to have a centered aligned web site, meaning the main wrapper to you site is aligned center to the page. If you continue to bubble up the float, your align centered site is not longer centered cause your main element is now floating.</p>
<h3>So how do we fix this float problem with out bubbling up the floats to our parent elements?</h3>
<p>Simple with the help of our <strong>overflow</strong> style!</p>
<p>By simply adding an <strong>overflow:hidden;</strong> to our parent element, our browser whips the parent element back into shape. The best way to explain why this is happening is to say that with the overflow rule, our browser re-thinks how this element should look and is more mindful about children elements who are floating.</p>
<p>So to conclude, collapsed elements due to floating children = overflow:hidden; to parent element for fix.</p>
<p><strong>Example of the fix (Notice overflow:hidden; location):</strong></p>
<pre>#parent {
margin:auto;
width:900px;
border:2px #000 solid;
overflow:hidden; /*THE FIX*/
}
#parent #left {
width:100px;
float:left;
}
#parent #right{
width:800px;
float:right;
}

#parent #left,
#parent #right {display:inline;}</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.devinrolsen.com/fix-collapsing-elements-with-floating-childen/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<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/dolsen/demos/css/infinite-sub-menu" target="_blank"></a>&nbsp;</p>
<p><div id="attachment_1151" class="wp-caption alignnone" style="width: 525px"><a href="http://www.devinrolsen.com/wp-content/themes/dolsen/demos/css/infinite-sub-menu" target="_blank"><img class="size-full wp-image-1151 " title="infin-subs" src="http://www.devinrolsen.com/wp-content/uploads/2010/06/infin-subs.png" alt="" width="515" height="254" /></a><p class="wp-caption-text">Preview the example:</p></div></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 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 id="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;</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 id="nav"&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: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 id="nav"&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: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>
<h2>Completed CSS Code:</h2>
<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><a href="http://www.devinrolsen.com/wp-content/themes/dolsen/demos/css/infinite-sub-menu">Preview the example.</a></p>
<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>42</slash:comments>
		</item>
		<item>
		<title>How to Build a jQuery Lava Lamp Menu</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[<div id="attachment_1153" class="wp-caption alignleft" style="width: 460px"><a title="Lava Lamp Tutorial Example Demo" href="http://www.devinrolsen.com/wp-content/themes/dolsen/demos/jquery/lavalamp"><img class="size-full wp-image-1153" title="lava-menu" src="http://www.devinrolsen.com/wp-content/uploads/2009/12/lava-menu.png" alt="" width="450" height="108" /></a><p class="wp-caption-text">Example:</p></div>
<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><br/></p>
<h3>The Video Tutorial:</h3>
<p><object style="margin:auto; display:block;" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="440" height="345" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="wmode" value="transparent" /><param name="src" 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" /><embed type="application/x-shockwave-flash" width="440" height="345" 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" wmode="transparent" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<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/dolsen/images/rounder.gif" /&gt;&lt;/div&gt;
                    &lt;div id="tr"&gt;&lt;img src="http://www.devinrolsen.com/wp-content/themes/dolsen/images/rounder.gif" /&gt;&lt;/div&gt;
                    &lt;div id="bl"&gt;&lt;img src="http://www.devinrolsen.com/wp-content/themes/dolsen/images/rounder.gif" /&gt;&lt;/div&gt;
                    &lt;div id="br"&gt;&lt;img src="http://www.devinrolsen.com/wp-content/themes/dolsen/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>11</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.</p>
<pre>#boxWrap {width:200px; height:200px; border:1px #000 dashed; position:relative;}
#layer1,#layer2{ width:150px; height:150px; }

#layer1 {
left:375px;
top:80px;
background:#000;
z-index:2;
position:absolute;
}

#layer2 {
left:285px;
top:-50px;
border:1px #fff solid;
background:#666;
z-index:1;
position:relative;
}</pre>
<p>And the HTML:</p>
<pre>&lt;body&gt;
&lt;div id="boxWrap"&gt;
&lt;div id="layer1"&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;div id="layer2"&gt;&lt;/div&gt;
&lt;/body&gt;</pre>
<p>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>3</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 16: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 menu with three sub-levels. This version of the vertical navigation menu will work in IE5 / IE6 (with CSS pseudo hover fix), IE7, IE8, IE9, as well as FF, Safari and Chrome.]]></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 menu with three sub-levels. This version of the vertical navigation menu will work in IE5 / IE6 (with CSS pseudo hover fix), IE7, IE8, IE9, as well as FF, Safari and Chrome.</p>
<p>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 that, 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 the vertical fashion that is given to us by default in the ordered lists. The un-ordered list for vertical menus almost seems to be a match made in CSS heaven, vs. its sister menu the <a title="Pure CSS Horizontal Menu Tutorial" href="http://www.devinrolsen.com/pure-css-horizontal-menu/">horizontal navigation menu</a>.</p>
<p>So let begin to add some style to our first level un-ordered list, and its parent container “navigation”. In our header let&#8217;s create style tags that will contain all our CSS.</p>
<p>Our first CSS rule we want to add would be for our container:</p>
<pre>&lt;style type="text/css"&gt;
    <strong>#navigation {font-size:0.75em; width:150px;}</strong>
&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 menu&#8217;s font size to that of 0.75em that will cascade down our entire menu.</p>
<p>Great, next we are going to create two new rules for our first level un-ordered list:</p>
<pre>&lt;style type="text/css"&gt;
    #navigation {font-size:0.75em; width:150px;}
    <strong>#navigation ul {margin:0; padding:0;}</strong>
    <strong>#navigation li {list-style: none;}</strong>
&lt;/style&gt;</pre>
<p>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 default with a un-ordered list by setting both to 0 pixels. We also remove any default list style by setting list-style to none, over all our list items.</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://www.devinrolsen.com/wp-content/uploads/2009/09/fig11.gif"><img class="size-full wp-image-1438 alignnone" title="fig1" src="http://www.devinrolsen.com/wp-content/uploads/2009/09/fig11.gif" alt="Figure one" width="167" height="92" /></a></p>
<p>Again not looking to hot right now, but we will get there. Our next step is to assign some styles to only our top level list items, by going back to our HTML markup and add a new class to our un-ordered element. While we are adding this new class, let&#8217;s also add some links to our HTML markup as well like so:</p>
<pre>&lt;div id="navigation"&gt;
    &lt;ul class="<strong>top-level</strong>"&gt;
        &lt;li&gt;<em><strong>&lt;a href="#"&gt;Home&lt;/a&gt;</strong></em>&lt;/li&gt;
        &lt;li&gt;<em><strong>&lt;a href="#"&gt;About&lt;/a&gt;</strong></em>&lt;/li&gt;
        &lt;li&gt;<em><strong>&lt;a href="#"&gt;Contact&lt;/a&gt;</strong></em>&lt;/li&gt;
        &lt;li&gt;<em><strong>&lt;a href="#"&gt;FAQ&lt;/a&gt;</strong></em>&lt;/li&gt;
        &lt;li&gt;<em><strong>&lt;a href="#"&gt;News&lt;/a&gt;</strong></em>&lt;/li&gt;
    &lt;/ul&gt;
&lt;/div&gt;</pre>
<p>Now we can better target just our top level menu and its list items. With our new top-level class in place, let&#8217;s now add the following new styles:</p>
<pre>#navigation {font-size:0.75em; width:150px;}
#navigation ul {margin:0px; padding:0px;}
#navigation li {list-style: none;}
<strong>
ul.top-level {background:#666;}
ul.top-level li {</strong>
<strong> border-bottom: #fff solid;</strong>
<strong> border-top: #fff solid;</strong>
<strong> border-width: 1px;</strong>
<strong>}</strong></pre>
<p>Here we are pointing to our new top-level (ul element) and setting it background color to be #666 (dark gray). Next we point to our top-level ul, then its list item children and apply a border to top and bottom with a color of #fff (white) and is 1px wide.</p>
<p>Great, now lets target our menu&#8217;s anchor tags as well by adding the following styles:</p>
<pre>#navigation {font-size:0.75em; width:150px;}
#navigation ul {margin:0px; padding:0px;}
#navigation li {list-style: none;}
<strong><strong>
</strong></strong>ul.top-level {background:#666;}
ul.top-level li {
 border-bottom: #fff solid;
 border-top: #fff solid;
 border-width: 1px;
}

<strong>#navigation a {
 color: #fff;
 cursor: pointer;
 display:block;
 height:25px;
 line-height: 25px;
 text-indent: 10px;                   
 text-decoration:none;
 width:100%;
}
#navigation a:hover{
 text-decoration:underline;
}</strong></pre>
<p>To begin, we set a height of 25 pixels to space out our list item&#8217;s anchors out vertically, then we make up for text placement by using the line-height that is equal to our height. We also set a text-indent to inset the text a little, text-decoration to remove underlines, color to #fff (White), cursor to pointer and set a full width of 100%.</p>
<p>The most important part of our new styles, is that we set a display block on our anchor tags. Without setting them to be rendered as block, our width and height are meaningless.</p>
<p>Our last bit of styles is for the hover state of our anchor tags. Basically once they are being hovered, we set the text-decoration back to being underline for presentational purposes.</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>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, and then all the list items in our entire menu. Once we are pointing to our menu&#8217;s list items, we append a pseudo hover selector to begin the statement for our color behavior:</p>
<pre>#navigation {font-size:0.75em; width:150px;}
#navigation ul {margin:0px; padding:0px;}
#navigation li {list-style: none;} 

ul.top-level {background:#666;}
ul.top-level li {
 border-bottom: #fff solid;
 border-top: #fff solid;
 border-width: 1px;
}

#navigation a {
 color: #fff;
 cursor: pointer;
 display:block;
 height:25px;
 line-height: 25px;
 text-indent: 10px;
 text-decoration:none;
 width:100%;
}
#navigation a:hover{
 text-decoration:underline;
}

<strong>#navigation li:hover {</strong>
<strong> background: #f90;</strong>
<strong> position: relative;</strong>
<strong>}</strong></pre>
<p>Here we are  giving our list items both a background-color of #F90, and setting 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. We also get the position of relative to our list items here at the hover state, in order to fix IE related ghost bug  issues.</p>
<p>Here is what our menu behavior should look like now:</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>Let&#8217;s now move into our second level un-ordered lists. We always nest our sub menus deeper within the list item we want them to be displayed under, like the following now:</p>
<pre>&lt;div id="navigation"&gt;
    &lt;ul class="top-level"&gt;
        &lt;li&gt;&lt;a href="#"&gt;Home&lt;/a&gt;
<strong>            &lt;ul class="<em>sub-level</em>"&gt;
                &lt;li&gt;&lt;a href="#"&gt;Sub Menu Item 1&lt;/a&gt;&lt;/li&gt;
                &lt;li&gt;&lt;a href="#"&gt;Sub Menu Item 2&lt;/a&gt;&lt;/li&gt;
                &lt;li&gt;&lt;a href="#"&gt;Sub Menu Item 3&lt;/a&gt;&lt;/li&gt;
                &lt;li&gt;&lt;a href="#"&gt;Sub Menu Item 3&lt;/a&gt;&lt;/li&gt;
            &lt;/ul&gt;</strong>
        &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;/li&gt;
        &lt;li&gt;
            &lt;a href="#"&gt;FAQ&lt;/a&gt;
<strong>            &lt;ul class="<em>sub-level</em>"&gt;
                &lt;li&gt;&lt;a href="#"&gt;Sub Menu Item 1&lt;/a&gt;&lt;/li&gt;
                &lt;li&gt;&lt;a href="#"&gt;Sub Menu Item 3&lt;/a&gt;&lt;/li&gt;
            &lt;/ul&gt;</strong>
        &lt;/li&gt;
        &lt;li&gt;
            &lt;a href="#"&gt;News&lt;/a&gt;
<strong>            &lt;ul class="<em>sub-level</em>"&gt;
                &lt;li&gt;&lt;a href="#"&gt;Sub Menu Item 1&lt;/a&gt;&lt;/li&gt;
                &lt;li&gt;&lt;a href="#"&gt;Sub Menu Item 2&lt;/a&gt;&lt;/li&gt;
                &lt;li&gt;&lt;a href="#"&gt;Sub Menu Item 3&lt;/a&gt;&lt;/li&gt;
            &lt;/ul&gt;</strong>
        &lt;/li&gt;
    &lt;/ul&gt;
&lt;/div&gt;</pre>
<p>Take notice at how we have nested our new un-ordered lists to our first level list items. Also notice that these new level of un-orderd lists carry a new class of &#8220;sub-level&#8221;. From here on out, all sub level menus will need to have this &#8220;sub-level&#8221; class.</p>
<p>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 styles to these second level un-ordered lists, simple reference them now by our new class of &#8220;sub-level&#8221; like so:</p>
<pre><strong>ul.sub-level {
    display: none;
}</strong></pre>
<p>Here we are giving our sub-level un-ordered lists a display of none. We do this so that by default, our second level un-ordered lists are hidden until told otherwise.</p>
<p>So now lets write the styles to expose our sub-level menus when its parent is being hoverd:</p>
<pre>ul.sub-level {
    display: none;
}<strong><strong>
</strong></strong><strong><strong>li:hover .sub-level {
    background: #999;
    border: #fff solid;
    border-width: 1px;
    display: block;
    position: absolute;
    left: 75px;
    top: 5px;
}</strong></strong></pre>
<p>Starting from the parent element (li), we set a pseudo hover selector and then point to our .sub-level menus. Once any parent list item is hovered, its child sub-level menu will be set to a display of block (exposed). We also set a position absolute and finally top and left styles to positioned around our sub-level menus in their parent&#8217;s relatively.</p>
<p>The next thing we want to setup, is our sub-level list items styles:</p>
<pre>ul.sub-level {
    display: none;
}<strong><strong>
</strong></strong>li:hover .sub-level {
    background: #999;
    border: #fff solid;
    border-width: 1px;
    display: block;
    position: absolute;
    left: 75px;
    top: 5px;
}
<strong>ul.sub-level li {
    border: none;
    float:left;
    width:150px;
}</strong></pre>
<p>Here we are simply floating our sub-level list items to the left, and setting their width to be fixed at a 150px. We also are removing the default borders that we setup on our global list item rule near the top.</p>
<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>Looking good! Now let’s create our last level un-ordered list. Like before we are going to insert a new un-ordered lists with in the list item we want to expose these third level un-ordered lists. We again are also giving this new level a class of sub-level.</p>
<p>Here is what our final HTML markup would look like:</p>
<pre>&lt;div id="navigation"&gt;
    &lt;ul class="top-level"&gt;
        &lt;li&gt;&lt;a href="#"&gt;Home&lt;/a&gt;
            &lt;ul class="<strong>sub-level</strong>"&gt;
                &lt;li&gt;&lt;a href="#"&gt;Sub Menu Item 1&lt;/a&gt;
                &lt;/li&gt;
                &lt;li&gt;&lt;a href="#"&gt;Sub Menu Item 2&lt;/a&gt;
                    &lt;ul class="<strong>sub-level</strong>"&gt;
                        &lt;li&gt;&lt;a href="#"&gt;Sub Sub Menu Item 1&lt;/a&gt;&lt;/li&gt;
                        &lt;li&gt;&lt;a href="#"&gt;Sub Sub Menu Item 2&lt;/a&gt;&lt;/li&gt;
                        &lt;li&gt;&lt;a href="#"&gt;Sub Sub Menu Item 3&lt;/a&gt;&lt;/li&gt;
                        &lt;li&gt;&lt;a href="#"&gt;Sub Sub Menu Item 4&lt;/a&gt;&lt;/li&gt;
                    &lt;/ul&gt;
                &lt;/li&gt;
                &lt;li&gt;&lt;a href="#"&gt;Sub Menu Item 3&lt;/a&gt;&lt;/li&gt;
                &lt;li&gt;&lt;a href="#"&gt;Sub Menu Item 3&lt;/a&gt;&lt;/li&gt;
            &lt;/ul&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;/li&gt;
        &lt;li&gt;
            &lt;a href="#"&gt;FAQ&lt;/a&gt;
            &lt;ul class="<strong>sub-level</strong>"&gt;
                &lt;li&gt;&lt;a href="#"&gt;Sub Menu Item 1&lt;/a&gt;&lt;/li&gt;
                &lt;li&gt;&lt;a href="#"&gt;Sub Menu Item 3&lt;/a&gt;
                    &lt;ul class="<strong>sub-level</strong>"&gt;
                        &lt;li&gt;&lt;a href="#"&gt;Sub Sub Menu Item 1&lt;/a&gt;&lt;/li&gt;
                        &lt;li&gt;&lt;a href="#"&gt;Sub Sub Menu Item 2&lt;/a&gt;&lt;/li&gt;
                        &lt;li&gt;&lt;a href="#"&gt;Sub Sub Menu Item 3&lt;/a&gt;&lt;/li&gt;
                        &lt;li&gt;&lt;a href="#"&gt;Sub Sub Menu Item 4&lt;/a&gt;&lt;/li&gt;
                    &lt;/ul&gt;
                &lt;/li&gt;
            &lt;/ul&gt;
        &lt;/li&gt;
        &lt;li&gt;
            &lt;a href="#"&gt;News&lt;/a&gt;
            &lt;ul class="<strong>sub-level</strong>"&gt;
                &lt;li&gt;&lt;a href="#"&gt;Sub Menu Item 1&lt;/a&gt;
                    &lt;ul class="<strong>sub-level</strong>"&gt;
                        &lt;li&gt;&lt;a href="#"&gt;Sub Sub Menu Item 1&lt;/a&gt;&lt;/li&gt;
                        &lt;li&gt;&lt;a href="#"&gt;Sub Sub Menu Item 2&lt;/a&gt;&lt;/li&gt;
                        &lt;li&gt;&lt;a href="#"&gt;Sub Sub Menu Item 3&lt;/a&gt;&lt;/li&gt;
                        &lt;li&gt;&lt;a href="#"&gt;Sub Sub Menu Item 4&lt;/a&gt;&lt;/li&gt;
                    &lt;/ul&gt;
                &lt;/li&gt;
                &lt;li&gt;&lt;a href="#"&gt;Sub Menu Item 2&lt;/a&gt;&lt;/li&gt;
                &lt;li&gt;&lt;a href="#"&gt;Sub Menu Item 3&lt;/a&gt;&lt;/li&gt;
            &lt;/ul&gt;
        &lt;/li&gt;
    &lt;/ul&gt;
&lt;/div&gt;</pre>
<p>Last few styles are for creative preference and bug squashing really:</p>
<pre><strong>/*Seconda Level*/
#navigation .sub-level {
    background: #999;
}

/*Third Level*/
#navigation .sub-level .sub-level {
    background: #09C;
}</strong></pre>
<p>Our first style is pointing to our first sub-level menus from #navigation (#navigaiton ul ul) and setting its background to #999 (light gray). The second style is pointing to our second sub-level menus also from #navigation and setting its background to #09c(light blue). This shows you how to specifically target different levels of nested menus and style them accordingly if you desire.</p>
<p>The last two styles are to help out some confused browsers (IE6+) about what to do with third level menus, while hovering a top level menu item.</p>
<p>You can more or less consider this to be a nice reset to kick them browsers back into shape:</p>
<pre><strong>/*RESET STYLES*/
li:hover .sub-level .sub-level {</strong>
<strong>	display:none;</strong>
<strong>}</strong>
<strong>.sub-level li:hover .sub-level {</strong>
<strong>	display:block;</strong>
<strong>}</strong></pre>
<p>Let&#8217;s break down these reset selectors. The first states, &#8220;When a list item is being hovered, find the closest nested .sub-level menu. If that closest nested sub-level menu also has a nested .sub-level menu, hide it&#8217;s nested sub-level menu from view.&#8221; We do this so that only one sub-level menu is exposed at a time while its parent list item is being hovered.</p>
<p>Nest we reverse the role to make up for our first reset condition. This second selector is saying &#8220;If you are with in a sub-level menu item, and you hover over a list item that indeed has a nested sub-level menu, expose it&#8217;s sub-level menu.&#8221;</p>
<p>Lets see what we have now! You can click the figure (image) below to preview the tutorial example:</p>
<div id="attachment_232" class="wp-caption alignnone" style="width: 376px"><a href="http://devinrolsen.com/wp-content/themes/dolsen/demos/css/vertical-menu/WORKS.html"><img class="size-full wp-image-232  " title="Tutorial's Working Example" src="http://devinrolsen.com/wp-content/uploads/2009/09/fig5.gif" alt="Tutorial's Working Example" width="366" height="237" /></a><p class="wp-caption-text">Click Here for Tutorial&#39;s Working Example:</p></div>
<p>&nbsp;</p>
<p>If you need this to work in IE6, please refer to this tutorial here. <a title="IE6 CSS Pseudo Selector Hover Fix Tutorial" href="http://www.devinrolsen.com/fix-css-pseudo-hover/">http://www.devinrolsen.com/fix-css-pseudo-hover/</a></p>
<p>That&#8217;s it everyone, you have just created a pure CSS vertical menu with sub level pop outs that is completely cross browser friendly.</p>
<p>Thanks everyone.</p>
<p>Devin R. Olsen</p>
<div id="_mcePaste" class="mcePaste" style="position: absolute; left: -10000px; top: 3651px; width: 1px; height: 1px; overflow: hidden;">&lt;div id=&#8221;navigation&#8221;&gt;<br />
&lt;ul class=&#8221;top-level&#8221;&gt;<br />
&lt;li&gt;&lt;a href=&#8221;#&#8221;&gt;Home&lt;/a&gt;<br />
&lt;ul class=&#8221;sub-level&#8221;&gt;<br />
&lt;li&gt;&lt;a href=&#8221;#&#8221;&gt;Sub Menu Item 1&lt;/a&gt;&lt;/li&gt;<br />
&lt;li&gt;&lt;a href=&#8221;#&#8221;&gt;Sub Menu Item 2&lt;/a&gt;&lt;/li&gt;<br />
&lt;li&gt;&lt;a href=&#8221;#&#8221;&gt;Sub Menu Item 3&lt;/a&gt;&lt;/li&gt;<br />
&lt;li&gt;&lt;a href=&#8221;#&#8221;&gt;Sub Menu Item 3&lt;/a&gt;&lt;/li&gt;<br />
&lt;/ul&gt;<br />
&lt;/li&gt;<br />
&lt;li&gt;&lt;a href=&#8221;#&#8221;&gt;About&lt;/a&gt;&lt;/li&gt;<br />
&lt;li&gt;&lt;a href=&#8221;#&#8221;&gt;Contact&lt;/a&gt;&lt;/li&gt;<br />
&lt;li&gt;<br />
&lt;a href=&#8221;#&#8221;&gt;FAQ&lt;/a&gt;<br />
&lt;ul class=&#8221;sub-level&#8221;&gt;<br />
&lt;li&gt;&lt;a href=&#8221;#&#8221;&gt;Sub Menu Item 1&lt;/a&gt;&lt;/li&gt;<br />
&lt;li&gt;&lt;a href=&#8221;#&#8221;&gt;Sub Menu Item 3&lt;/a&gt;&lt;/li&gt;<br />
&lt;/ul&gt;<br />
&lt;/li&gt;<br />
&lt;li&gt;<br />
&lt;a href=&#8221;#&#8221;&gt;News&lt;/a&gt;<br />
&lt;ul class=&#8221;sub-level&#8221;&gt;<br />
&lt;li&gt;&lt;a href=&#8221;#&#8221;&gt;Sub Menu Item 1&lt;/a&gt;&lt;/li&gt;<br />
&lt;li&gt;&lt;a href=&#8221;#&#8221;&gt;Sub Menu Item 2&lt;/a&gt;&lt;/li&gt;<br />
&lt;li&gt;&lt;a href=&#8221;#&#8221;&gt;Sub Menu Item 3&lt;/a&gt;&lt;/li&gt;<br />
&lt;/ul&gt;<br />
&lt;/li&gt;<br />
&lt;/ul&gt;<br />
&lt;/div&gt;</div>
]]></content:encoded>
			<wfw:commentRss>http://www.devinrolsen.com/pure-css-vertical-menu/feed/</wfw:commentRss>
		<slash:comments>232</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. [...]]]></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/dolsen/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>19</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>8</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>
<h2>Why rounded corners ?</h2>
<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>
<h2>Are rounded corners necessary?</h2>
<p>Absolutely not, but hey back in the beginning of web development neither was a lot of things such as background colors HAHA.</p>
<h2>Is this the only way to make rounded corners?</h2>
<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.)</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&#8217;m going to use a combination of a div box and an un-ordered list because its easier to maintain in an actual html document..</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 having multiple boxes with rounded corners is high.</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 rule so we can get a good idea of whats 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 then point to any un-ordered lists we have nested inside &#8220;<strong>.cell</strong>&#8220;.</p>
<p><strong>.cell li {}</strong> is like the &#8220;<strong>.cell ul&#8221;</strong> in the manor that it too uses &#8220;<strong>.cell</strong>&#8221; to point to any un-ordered lists we have nested. However, &#8220;<strong>.cell li</strong>&#8221; is specifically pointing to all list items within an un-ordered list that resides in our &#8220;<strong>.cell</strong>&#8221; div box.</p>
<p>Let’s now start adding styles to our classes by making 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 &#8220;<strong>.cell</strong>&#8221; class you can see that we have created a background-color, and a padding of 21px. I use a padding of 21px 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.</p>
<p>I have also placed a <em>position:relative;</em> property in our &#8220;<strong>.cell</strong>&#8221; class cause we are going to be using a position of absolute for our four corners.</p>
<p>Finlay we have a float:left; and display: inline;. (<em>For IE users that don&#8217;t set a desired width this is important because with our floating our &#8220;<strong>.cell</strong>&#8221; get messed up in versions of IE5 and IE6. As a good practice always include display of inline when floating an element.)</em></p>
<p>&#8220;<strong>.cell ul</strong>&#8221; has set it&#8217;s margin / padding set to 0px in order to remove any default browser behavior of spacing. The &#8220;<strong>.cell li</strong>&#8220; has <em>list-style:none;</em>, and it also remove any default browser behavior (list item bullet points).</p>
<p>Next we are going to create classes for our four corners by adding the following to our 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 &#8220;<strong>.cell</strong>&#8221; 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 that we are positioning to the inside of our four corners.</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.</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, 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? 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 (<strong><em>Click image to see demo</em></strong>).</p>
<p><a href="http://devinrolsen.com/wp-content/themes/dolsen/demos/css/rounded-corners/WORKS.html" target="_blank"><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>
]]></content:encoded>
			<wfw:commentRss>http://www.devinrolsen.com/rounded-corners-with-css-and-one-image/feed/</wfw:commentRss>
		<slash:comments>46</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 [...]]]></description>
			<content:encoded><![CDATA[<h3><a title="Pure CSS Light Box" href="http://www.devinrolsen.com/wp-content/themes/dolsen/demos/css/css-lightbox/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/dolsen/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>15</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk

Served from: www.devinrolsen.com @ 2012-02-05 12:18:19 -->
