<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-GB">
<head>
	<title>The Perfect Multi-Column Stacked Liquid Layout: No CSS hacks. SEO friendly. iPhone compatible.</title>
	<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
	<meta name="description" content="The Perfect Multi-Column Stacked Liquid Layout: No CSS hacks. SEO friendly. iPhone compatible." />
	<meta name="keywords" content="The Perfect Multi-Column Stacked Liquid Layout: No CSS hacks. SEO friendly. iPhone compatible." />
	<meta name="robots" content="index, follow" />
	<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
	<style media="screen" type="text/css">
	/* <!-- */
	/* General styles */
	body {
		margin:0;
		padding:0;
		border:0;			/* This removes the border around the viewport in old versions of IE */
		width:100%;
		background:#fff;
		min-width:600px;		/* Minimum width of layout - remove line if not required */
						/* The min-width property does not work in old versions of Internet Explorer */
		font-size:90%;
	}
	a {
		color:#369;
	}
	a:hover {
		color:#fff;
		background:#369;
		text-decoration:none;
	}
	h1, h2, h3 {
		margin:.8em 0 .2em 0;
		padding:0;
	}
	p {
		margin:.4em 0 .8em 0;
		padding:0;
	}
	img {
		margin:10px 0 5px;
	}
	/* Header styles */
	#header {
		clear:both;
		float:left;
		width:100%;
	}
	#header {
		border-bottom:1px solid #000;
	}
	#header p,
	#header h1,
	#header h2 {
		padding:.4em 15px 0 15px;
		margin:0;
	}
	#header ul {
		clear:left;
		float:left;
		width:100%;
		list-style:none;
		margin:10px 0 0 0;
		padding:0;
	}
	#header ul li {
		display:inline;
		list-style:none;
		margin:0;
		padding:0;
	}
	#header ul li a {
		display:block;
		float:left;
		margin:0 0 0 1px;
		padding:3px 10px;
		text-align:center;
		background:#eee;
		color:#000;
		text-decoration:none;
		position:relative;
		left:15px;
		line-height:1.3em;
	}
	#header ul li a:hover {
		background:#369;
		color:#fff;
	}
	#header ul li a.active,
	#header ul li a.active:hover {
		color:#fff;
		background:#000;
		font-weight:bold;
	}
	#header ul li a span {
		display:block;
	}
	/* 'widths' sub menu */
	#layoutdims {
		clear:both;
		background:#eee;
		border-top:4px solid #000;
		margin:0;
		padding:6px 15px !important;
		text-align:right;
	}
	/* column container */
	.colmask {
		position:relative;	/* This fixes the IE7 overflow hidden bug */
		clear:both;
		float:left;
		width:100%;			/* width of whole page */
		overflow:hidden;		/* This chops off any overhanging divs */
	}
	/* common column settings */
	.colleft,
	.colmid,
	.colright {
		float:left;
		width:100%;
		position:relative;
	}
	.col1,
	.col2,
	.col3 {
		float:left;
		position:relative;
		padding:0 0 1em 0;
		overflow:hidden;
	}
	/* 3 Column settings */
	.threecol {
		background:#eee;		/* right column background colour */
	}
	.threecol .colmid {
		right:25%;			/* width of the right column */
		background:#fff;		/* center column background colour */
	}
	.threecol .colleft {
		right:50%;			/* width of the middle column */
		background:#f4f4f4;	/* left column background colour */
	}
	.threecol .col1 {
		width:46%;			/* width of center column content (column width minus padding on either side) */
		left:102%;			/* 100% plus left padding of center column */
	}
	.threecol .col2 {
		width:21%;			/* Width of left column content (column width minus padding on either side) */
		left:31%;			/* width of (right column) plus (center column left and right padding) plus (left column left padding) */
	}
	.threecol .col3 {
		width:21%;			/* Width of right column content (column width minus padding on either side) */
		left:85%;			/* Please make note of the brackets here:
						(100% - left column width) plus (center column left and right padding) plus (left column left and right padding) plus (right column left padding) */
	}
	/* 3 Column blog style settings */
	.blogstyle {
		background:#eee;		/* right column background colour */
	}
	.blogstyle .colmid {
		right:25%;			/* width of the right column */
		background:#f4f4f4;	/* center column background colour */
	}
	.blogstyle .colleft {
		right:25%;			/* width of the middle column */
		background:#fff;		/* left column background colour */
	}
	.blogstyle .col1 {
		width:46%;			/* width of center column content (column width minus padding on either side) */
		left:52%;			/* 100% plus left padding of center column */
	}
	.blogstyle .col2 {
		width:21%;			/* Width of left column content (column width minus padding on either side) */
		left:56%;			/* width of (right column) plus (center column left and right padding) plus (left column left padding) */
	}
	.blogstyle .col3 {
		width:21%;			/* Width of right column content (column width minus padding on either side) */
		left:60%;			/* Please make note of the brackets here:
						(100% - left column width) plus (center column left and right padding) plus (left column left and right padding) plus (right column left padding) */
	}
	/* 2 Column (left menu) settings */
	.leftmenu {
		background:#fff;		/* right column background colour */
	}
	.leftmenu .colleft {
		right:75%;			/* right column width */
		background:#f4f4f4;	/* left column background colour */
	}
	.leftmenu .col1 {
		width:71%;			/* right column content width */
		left:102%;			/* 100% plus left column left padding */
	}
	.leftmenu .col2 {
		width:21%;			/* left column content width (column width minus left and right padding) */
		left:6%;			/* (right column left and right padding) plus (left column left padding) */
	}
	/* 2 Column (right menu) settings */
	.rightmenu {
		background:#eee;		/* right column background colour */
	}
	.rightmenu .colleft {
		right:25%;			/* right column width */
		background:#fff;		/* left column background colour */
	}
	.rightmenu .col1 {
		width:71%;			/* left column content width (left column width minus left and right padding) */
		left:27%;			/* (right column width) plus (left column left padding) */
	}
	.rightmenu .col2 {
		width:21%;			/* right column content width (right column width minus left and right padding) */
		left:31%;			/* (right column width) plus (left column left and right padding) plus (right column left padding) */
	}
	/* 2 Column (double page) settings */
	.doublepage {
		background:#eee;		/* right column background colour */
	}
	.doublepage .colleft {
		right:50%;			/* right column width */
		background:#fff;		/* left column background colour */
	}
	.doublepage .col1 {
		width:46%;			/* left column content width (column width minus left and right padding) */
		left:52%;			/* right column width plus left column left padding */
	}
	.doublepage .col2 {
		width:46%;			/* right column content width (column width minus left and right padding) */
		left:56%;			/* (right column width) plus (left column left and right padding) plus (right column left padding) */
	}
	/* Full page settings */
	.fullpage {
		background:#fff;		/* page background colour */
	}
	.fullpage .col1 {
		width:96%;			/* page width minus left and right padding */
		left:2%;			/* page left padding */
	}
	/* Footer styles */
	#footer {
		clear:both;
		float:left;
		width:100%;
		border-top:1px solid #000;
	}
	#footer p {
		padding:10px;
		margin:0;
	}
	/* --> */
	</style>
</head>
<body>

<div id="header">
	<p><a href="http://matthewjamestaylor.com/blog/perfect-multi-column-liquid-layouts" title="Perfect multi-column liquid layouts - iPhone compatible">&laquo; Back to the CSS article</a> by <a href="http://matthewjamestaylor.com">Matthew James Taylor</a></p>
	<h1>The Perfect Multi-Column Stacked Liquid Layout</h1>
	<h2>No CSS hacks. SEO friendly. No Images. No JavaScript. Cross-browser &amp; iPhone compatible.</h2>
	<ul>
		<li><a href="http://matthewjamestaylor.com/blog/perfect-3-column.htm">3 Column <span>Holy Grail</span></a></li>
		<li><a href="http://matthewjamestaylor.com/blog/perfect-3-column-blog-style.htm">3 Column <span>Blog Style</span></a></li>
		<li><a href="http://matthewjamestaylor.com/blog/perfect-2-column-left-menu.htm">2 Column <span>Left Menu</span></a></li>
		<li><a href="http://matthewjamestaylor.com/blog/perfect-2-column-right-menu.htm">2 Column <span>Right Menu</span></a></li>
		<li><a href="http://matthewjamestaylor.com/blog/perfect-2-column-double-page.htm">2 Column <span>Double Page</span></a></li>
		<li><a href="http://matthewjamestaylor.com/blog/perfect-full-page.htm">1 Column <span>Full Page</span></a></li>
		<li><a href="http://matthewjamestaylor.com/blog/perfect-stacked-columns.htm" class="active">Stacked <span>columns</span></a></li>
	</ul>
	<p id="layoutdims">Measure columns in: <a href="http://matthewjamestaylor.com/blog/ultimate-stacked-columns-pixels.htm">Pixel widths</a> | <a href="http://matthewjamestaylor.com/blog/ultimate-stacked-columns-ems.htm">Em widths</a> | <strong>Percentage widths</strong></p>
</div>
<div class="colmask threecol">
	<div class="colmid">
		<div class="colleft">
			<div class="col1">
				<!-- Column 1 start -->
				<h2>Combining column variations</h2>
				<p>The five styles of columns in this design series can be combined into new layouts by stacking the columns on top of each other. Any number of columns can be stacked and they can be in any order. The number of possibilities are endless.</p>
				<p>Simply include the style rules for each type of column layout used on the page. The CSS has been designed so it is easy to add and remove them.</p>
				<p>See the main page on each column variation for dimensions, nested div structures and positioning.</p>
				<!-- Column 1 end -->
			</div>
			<div class="col2">
				<!-- Column 2 start -->
				<h2>No CSS hacks</h2>
				<p>The CSS used for this layout is 100% valid and hack free. To overcome Internet Explorer's broken box model, no horizontal padding or margins are used. Instead, this design uses percentage widths and clever relative positioning.</p>
				<!-- Column 2 end -->
			</div>
			<div class="col3">
				<!-- Column 3 start -->
				<h2>SEO friendly</h2>
				<p>The higher up content is in your page code, the more important it is considered by search engine algorithms. To make your website as optimised as possible your main page content must come before the side column content. Each of the column stacks follow this principle, see the main page for each one for more information.</p>
				<!-- Column 3 end -->
			</div>
		</div>
	</div>
</div>
<div class="colmask blogstyle">
	<div class="colmid">
		<div class="colleft">
			<div class="col1">
				<!-- Column 1 start -->
				<h2>Divs versus Classes</h2>
				<p>There are two main ways to reference a div or any other HTML element from your style-sheet, you can use an id (id="idname") or a class (class="classname") so which one is best? Well the answer is it depends on what you are trying to do.</p>
				<p>An id must be unique, this means you cannot have two elements on the one page with the same id. So an id is useful for something that never repeats on a page like a header or footer. Classes don't have to be unique so they can be used as many times as necessary. A good example of a repeatable element would be a link style, you can have as many links on a page as you like and they can all look the same by giving them the same class name.</p>
				<!-- Column 1 end -->
			</div>
			<div class="col2">
				<!-- Column 2 start -->
				<h2>Use classes for stackable columns</h2>
				<p>Because the columns in this stackable design can be repeated any number of times we cannot use ids because they would be duplicated. Only classes allow us to repeat the columns as many times as we like. So please keep that in mind if you are modifying this design. Of course if your modified layout does not have repeated columns then you can change some of the classes back to ids.</p>
				<!-- Column 2 end -->
			</div>
			<div class="col3">
				<!-- Column 3 start -->
				<h2>Equal height columns</h2>
				<p>It doesn't matter which column has the longest content in each column stack, the background colour of all columns will stretch down to meet the next stack. This feature was traditionally only available with table based layouts but now with a little CSS trickery we can do exactly the same with divs. Say goodbye to annoying short columns!</p>
				<!-- Column 3 end -->
			</div>
		</div>
	</div>
</div>
<div class="colmask leftmenu">
	<div class="colleft">
		<div class="col1">
			<!-- Column 1 start -->
			<h2>Full length column background colours</h2>
			<p>In this layout the background colours of each column will always stretch to the length of the longest column. This feature was traditionally only available with table based layouts but now with a little CSS trickery we can do exactly the same with divs. Say goodbye to annoying short columns!</p>
			<!-- Column 1 end -->
		</div>
		<div class="col2">
			<!-- Column 2 start -->
			<h2>No JavaScript</h2>
			<p>JavaScript is not required. Some website layouts rely on JavaScript hacks to resize divs and force elements into place but you won't see any of that nonsense here.</p>
			<!-- Column 2 end -->
		</div>
	</div>
</div>
<div class="colmask rightmenu">
	<div class="colleft">
		<div class="col1">
			<!-- Column 1 start -->
			<h2>Good uses of a stacked column layout</h2>
			<ul>
				<li><strong>Shopping websites</strong> with merchandised units or products in a grid-like layout.</li>
				<li><strong>News websites</strong> with stories grouped by genre into separate sections of the page.</li>
				<li><strong>Large blogs</strong> with lots of different content.</li>
				<li><strong>Business websites</strong> that need to hold a lot of information on the one page.</li>
				<li>And many more...</li>
			</ul>
			<!-- Column 1 end -->
		</div>
		<div class="col2">
			<!-- Column 2 start -->
			<h2>No Images</h2>
			<p>This layout requires no images. Many CSS website designs need images to colour in the column backgrounds but that is not necessary with this design. Why wast bandwidth and precious HTTP requests when you can do everything in pure CSS and XHTML?</p>
			<!-- Column 2 end -->
		</div>
	</div>
</div>
<div class="colmask doublepage">
	<div class="colleft">
		<div class="col1">
			<!-- Column 1 start -->
			<h2>Browser Compatibility</h2>
			<p>This 3 column liquid Layout has been tested on the following browsers:</p>
			<h3>iPhone &amp; iPod Touch</h3>
			<ul>
				<li>Safari</li>
			</ul>
			<h3>Mac</h3>
			<ul>
				<li>Safari</li>
				<li>Firefox</li>
				<li>Opera 9.25</li>
				<li>Netscape 9.0.0.5 &amp; 7.1</li>
			</ul>
			<h3>Windows</h3>
			<ul>
				<li>Firefox 1.5, 2 &amp; 3</li>
				<li>Safari</li>
				<li>Opera 8.1 &amp; 9</li>
				<li>Google Chrome</li>
				<li>Explorer 5.5, 6 &amp; 7</li>
				<li>Netscape 8</li>
			</ul>
			<!-- Column 1 end -->
		</div>
		<div class="col2">
			<!-- Column 2 start -->
			<h2>Valid XHTML strict markup</h2>
			<p>The HTML in this layout validates as XHTML 1.0 strict.</p>
			<h2>Resizable text compatible</h2>
			<p>This layout is fully compatible with resizable text. Resizable text is important for web accessibility. People who are vision impaired can make the text larger so it's easier for them to read. It is becoming increasingly more important to make your website resizable text compatible because people are expecting higher levels of web accessibility. Apple have made resizing the text on a website simple with the pinch gesture on their multi-touch trackpad. So far this trackpad is only available on the MacBook Air but it will soon be rolled out to all of their systems. Is your website text-resizing compatible?</p>
			<h2>No Quirks Mode</h2>
			<p>This liquid layout does not require the XML declaration for it to display correctly in older versions of Internet Explorer. This version works without it and is thus never in quirks mode.</p>
			<h2>No IE Conditional Comments</h2>
			<p>Only one stylesheet is used with this layout This means that IE conditional comments are not needed to set extra CSS rules for older versions of Internet Explorer.</p>
			<!-- Column 2 end -->
		</div>
	</div>
</div>
<div class="colmask fullpage">
	<div class="col1">
		<!-- Column 1 start -->
		<h2>This layout is FREE for anyone to use</h2>
		<p>That's right, you don't have to pay anything. Simply view the source of this page and save the HTML onto your computer. My only suggestion is to put the CSS into a separate file. If you are feeling generous however, link back to this page so other people can find and use this layout too.</p>
		<!-- Column 1 end -->
	</div>
</div>
<div id="footer">
	<p><a href="http://matthewjamestaylor.com/about">Contact me</a> if you have any problems, suggestions or questions about this layout. View more <a href="http://matthewjamestaylor.com/blog/-website-layouts">website layouts</a> and <a href="http://matthewjamestaylor.com/blog/-web-design">web design articles</a>.</p>
</div>

<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-1848067-8";
urchinTracker();
</script>

</body>
</html>