Picnic Website Code Tutorials

Three Column Fixed|Fluid|Fixed #4 - Content First - Website Template Tutorial

View Demo

Paul O'B came up with the original concept for this layout. I dumbed it down a little bit, cleaned it up, and made it a little easier to follow and replicate. This is a somewhat complicated layout which uses no images, but rather negative margins (among others) to create the equal height columns. However, as a result it cannot be given a width or a max-width because the columns themselves are the actual body color. This layout features, content first in the html, equal height columns, 100% height, header, sticky footer, fixed width left/right columns, and a fluid center.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Style: Three Column Fixed|Fluid|Fixed #4 </title>
<style type="text/css">
<!--
/* ----------------------------------------------------
Style: Three Column Fixed|Fluid|Fixed #4
Author: Eric Watson
Website: http://www.websitecodetutorials.com
------------------------------------------------------- 
: Site Colors : 

: Table Of Contents :
Resets
Defaults
Typography
Forms
Layout
Links
Menus
Global Classes
Content
---------------------------------------------------- */

/* -------------------- Resets --------------------- */
body, address, blockquote, dl, ol, ul, li, form, fieldset, h1, h2, h3, h4, h5, h6, p, pre {
	margin: 0;
	padding: 0;
}
fieldset, table {
	border: none;
}
a {
	outline: 0;
}
/* --------------- Document Defaults -------------- */
html {
	font-size: 100.01%;
	height: 100%;
}
body {
	height: 100%;
	font: 62.5%/1.5 Tahoma, Arial, Helvetica, 'MS Sans Serif', sans-serif;
	color: #333;
	background: #999;
	position: relative; /* for IE7 */
}
/* ------------------ Typography ------------------- */
h1 {
	font-size: 2.4em;
	text-align: center;
	padding: 38px 0 0;
}
h2 {
	font-size: 2em;
	text-align: center;
	margin: 100px 0 0;
}
h3 {
	font-size: 2em;
	text-align: center;
	padding: 17px 0 0;
}
p {
	font-size: 1.2em;
	margin: 1em;
	text-align: justify;
}
/* -------------------- Layout --------------------- */
#outerwrapper {
	min-height: 100%;
	margin: 0 200px;
	background: #CCC;
}
#innerwrapper {
	float: left;	
	width: 100%;
	padding-top: 121px; /* to clear header */
	margin-right: -3px; /* to stop columns dropping */
}
#header{
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 120px;
	background: #666;
	overflow: hidden;
}
#left {
	position: relative; /* IE needs this to show float */
	width: 200px;
	float: left;
	margin-left: -199px; /* must be 1px less than width otherwise won't push footer down in some browsers */
	left: -1px;
	padding-bottom: 72px; /* clear footer */
}
#right {
	position: relative; /* IE needs this to show float */
	width: 200px;
	float: right;
	margin-right: -199px; /* must be 1px less than width otherwise won't push footer down in some browsers */
	padding-top: 121px; /* to clear header */
	left: 1px;
	padding-bottom: 72px; /* clear footer */
}
#footer {
	width: 100%;
	clear: both;
	height: 70px;
	background: #666;
	position: relative;
	margin-top: -70px; /* drag footer from below the fold */
}
#centercontent {
	float: right;
	width: 100%;
	position: relative;
	padding-bottom: 72px; /* clear footer */
	margin-left: -1px;
}
/* --------------------- Links ---------------------- */

/* --------------------- Menus ---------------------- */
/* Main Menu */

/* Footer Menu */

/* ---------------- Global Classes ----------------- */
.clearer{
	height: 1px;
	overflow: hidden;
	margin-top: -1px;
	clear: both;
}
/* ----------------- Content/Pages ----------------- */
-->
</style>

<!--[if IE 6]>
<style type="text/css">
#outerwrapper {
	height:100%;
} 
#outerwrapper, #footer {
	width: 960px;
	width: expression(document.body.clientWidth <774? "770px" : document.body.clientWidth > 1028? "1024px" : "auto");
}
</style>
<![endif]-->

</head>
<body>
<div id="outerwrapper">
<div id="innerwrapper">

<div id="centercontent">
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Quisque tempor. Nam in libero vel nisi accumsan euismod. Quisque quis neque. Donec condimentum, enim convallis vestibulum varius, quam mi accumsan diam, sollicitudin ultricies odio ante vitae purus. Etiam ultricies quam. Vestibulum turpis turpis, fermentum ut, accumsan quis, tempor at, ipsum. Nam felis elit, sollicitudin id, ultrices faucibus, fringilla vel, dui. Aliquam tincidunt iaculis eros. Sed in lorem. Nullam eu enim. Quisque tristique pretium diam. Fusce tempor sollicitudin ligula. Donec purus eros, mattis quis, mattis vestibulum, congue quis, felis. Nulla facilisi. Nam ultricies posuere justo. In feugiat.</p>
<p>Ut lacus neque, interdum in, nonummy ac, placerat a, lorem. In interdum vulputate lectus. Aenean libero elit, eleifend id, tincidunt id, tristique eu, tortor. Pellentesque urna dolor, placerat a, pharetra eget, congue ut, ligula. Sed mi. Nunc volutpat. Donec pharetra accumsan lacus. Integer pede orci, vehicula vitae, porttitor id, pulvinar vel, nisi. Aliquam mauris ligula, eleifend sit amet, eleifend sit amet, luctus at, turpis. Sed neque orci, tincidunt id, tempus condimentum, eleifend a, nisl. Etiam auctor. Donec lectus lacus, consequat ac, ultrices venenatis, imperdiet vel, erat. In porttitor augue at tellus commodo pharetra.</p>
</div>

<div id="left">
<h2>Left</h2>
</div>

<div class="clearer">
</div>

</div><!--end #innerwrapper -->
	
<div id="right">
<h2>Right</h2>
</div>
	
<div class="clearer">
</div>

</div><!-- end #outerwrapper -->

<div id="footer">
<h3>Footer</h3>
</div>

<div id="header">
<h1>Header</h1>
</div>

</body>
</html>
		

Need help adding this or other code to your website? Post it here in the forum! Forum

Sponsors

Top Donators

Friends of Mine