<?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>Blue Lobster Art and Design - Sacramento Web Design and Graphic Design &#187; positioning</title>
	<atom:link href="http://blulob.com/tag/positioning/feed/" rel="self" type="application/rss+xml" />
	<link>http://blulob.com</link>
	<description>Web and graphic design</description>
	<lastBuildDate>Wed, 29 Sep 2010 23:46:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Master Your Website Layout with these 6 CSS Properties</title>
		<link>http://blulob.com/2009/06/03/6-ways-play-css-layers/</link>
		<comments>http://blulob.com/2009/06/03/6-ways-play-css-layers/#comments</comments>
		<pubDate>Thu, 04 Jun 2009 04:51:11 +0000</pubDate>
		<dc:creator>Dawn Pedersen</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[box model]]></category>
		<category><![CDATA[layers]]></category>
		<category><![CDATA[positioning]]></category>

		<guid isPermaLink="false">http://blulob.com/?p=3425</guid>
		<description><![CDATA[If you&#8217;re new to designing with CSS layout, it&#8217;s simple to get started with these six positioning properties: z-index position float clear top left There are more positioning properties, but we&#8217;ll begin with these most practical ones. To begin, here are two divs with very simple CSS rules. None of the special positioning properties have [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblulob.com%2F2009%2F06%2F03%2F6-ways-play-css-layers%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblulob.com%2F2009%2F06%2F03%2F6-ways-play-css-layers%2F&amp;source=bluelobsterart&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<div id="attachment_3492" class="wp-caption alignright" style="width: 160px"><img class="size-full wp-image-3492" title="Fancy div arranging" src="http://blulob.com/wordpress/wp-content/uploads/2009/06/mini-150.gif" alt="Fancy div arranging" width="150" height="150" /><p class="wp-caption-text">Fancy div arranging</p></div>
<p>If you&#8217;re new to designing with CSS layout, it&#8217;s simple to get started with these six positioning properties:<br />
<span id="more-3425"></span></p>
<ol>
<li>z-index</li>
<li>position</li>
<li>float</li>
<li>clear</li>
<li>top</li>
<li>left</li>
</ol>
<p>There are more positioning properties, but we&#8217;ll begin with these most practical ones.</p>
<p>To begin, here are two divs with very simple CSS rules. None of the special positioning properties have been applied yet (click on this image or any image below to view the live page.) We&#8217;ll call these the &#8220;simple&#8221; divs.</p>
<div id="attachment_3441" class="wp-caption alignnone" style="width: 460px"><a href="http://blulob.com/previews/css-layers-00.html"><img class="size-full wp-image-3441" title="CSS divs with no special positioning" src="http://blulob.com/wordpress/wp-content/uploads/2009/06/css-layers-00.gif" alt="CSS divs with no special positioning" width="450" height="387" /></a><p class="wp-caption-text">CSS divs with no special positioning</p></div>
<p>We&#8217;re using simple HTML too:</p>
<p class="code">&lt;body&gt;<br />
&lt;div id=&#8221;box1&#8243;&gt;<br />
[text]<br />
&lt;/div&gt;<br />
&lt;div id=&#8221;box2&#8243;&gt;<br />
[text]<br />
&lt;/div&gt;<br />
&lt;/body&gt;</p>
<h4>1. Z-Index</h4>
<p>The <strong>z-index</strong> CSS property identifies how &#8220;close&#8221; or &#8220;far away&#8221; a CSS layer is from the viewer. In other words, width goes in one dimension horizontally, height adds a second dimension vertically, and z-index adds a third dimension on an axis perpendicular to the screen. This is useful when divs overlap. The lower the z-index (e.g. z-index: 1;), the further back a div is. The higher it is (e.g. z-index: 99;), the more forward it is. This technique requires that you set the <strong>position</strong> to <em>relative</em> (we&#8217;ll look at <strong>position </strong>in greater detail later.)</p>
<p>Below, I&#8217;ve adjusted the margins of the second div so that the two boxes overlap. The purple box has a <strong>z-index</strong> of <em>1</em>, putting it behind the orange box which has a higher <strong>z-index</strong> of <em>2</em>. Both have a <strong>position</strong> of <em>relative</em>.</p>
<div id="attachment_3444" class="wp-caption alignnone" style="width: 460px"><a href="http://blulob.com/previews/css-layers-01.html"><img class="size-full wp-image-3444" title="Overlapping divs with different z-index values" src="http://blulob.com/wordpress/wp-content/uploads/2009/06/css-layers-01.gif" alt="Overlapping divs with different z-index values" width="450" height="387" /></a><p class="wp-caption-text">Overlapping divs with different z-index values</p></div>
<p>Here&#8217;s what happens if we switch the z-index values of the two boxes: the purple box moves to the front.</p>
<div id="attachment_3449" class="wp-caption alignnone" style="width: 460px"><a href="http://blulob.com/previews/css-layers-02.html"><img class="size-full wp-image-3449" title="Switch the z-index values" src="http://blulob.com/wordpress/wp-content/uploads/2009/06/css-layers-02.gif" alt="Switch the z-index values" width="450" height="387" /></a><p class="wp-caption-text">Switch the z-index values</p></div>
<h4>2. Position</h4>
<p>The <strong>position </strong>CSS property can be either set to static, relative, absolute, fixed. The default position is static.</p>
<ul>
<li><em>Static</em> divs get plunked down right where they are in the flow of the HTML.</li>
<li><em>Relative</em> divs are like <em>static </em>divs but can be moved relative to the previous content.</li>
<li><em>Absolute</em> divs get pulled out of the HTML flow and act independently of all other divs.</li>
<li><em>Fixed</em> divs work like <em>absolute </em>divs with a twist: they stay in the same place in the browser window even when you scroll down.</li>
</ul>
<p>We&#8217;ve looked at an application of the <em>relative </em>position above. Let&#8217;s go back to our simple divs and add <em>absolute </em>positions instead. Both divs are now positioned relative to top-left of the browser window instead of relative to each other.</p>
<div id="attachment_3453" class="wp-caption alignnone" style="width: 460px"><a href="http://blulob.com/previews/css-layers-03.html"><img class="size-full wp-image-3453" title="Absolute positioning" src="http://blulob.com/wordpress/wp-content/uploads/2009/06/css-layers-03.gif" alt="Absolute positioning" width="450" height="387" /></a><p class="wp-caption-text">Absolute positioning</p></div>
<p>A div with a <em>fixed </em>position stays in one place as you scroll.</p>
<div id="attachment_3457" class="wp-caption alignnone" style="width: 460px"><a href="http://blulob.com/previews/css-layers-09.html"><img class="alignnone size-full wp-image-3466" title="Fixed positioning" src="http://blulob.com/wordpress/wp-content/uploads/2009/06/css-layers-09.gif" alt="Fixed positioning" width="450" height="387" /><br />
<img class="alignnone size-full wp-image-3467" title="Fixed positioning" src="http://blulob.com/wordpress/wp-content/uploads/2009/06/css-layers-09a.gif" alt="Fixed positioning" width="450" height="387" /></a><p class="wp-caption-text">Fixed positioning</p></div>
<p>Next: <a href="http://blulob.com/2009/06/03/6-ways-play-css-layers/2/">3. Float</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blulob.com/2009/06/03/6-ways-play-css-layers/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>

