Single Column Web Page Layout with CSS

In an earlier post, I gave you Illustrator layout templates to easily allow you to design your web site. I now want to give you the HTML and CSS code to create a single-column web page from your exported slices from Adobe Illustrator.

full_width

CSS Code

You must use the following Cascading Style Sheet code for the layout of your single-column web page. Put this code in a style tag of your web page or in your external style sheet.

/* Copyright 2009 Laura B. Dahl
** When using this code, please add a comment in your code that credits my work
**
** General Layout rules
** Don't add padding or margin to these layout rules or your template will "blow up"
** Do add background images, text color, etc to customize your template look
*/
body {
	text-align: center;
	margin: 0px;
	padding: 0px;
	background-color: #999;
}
#wrapper {
	text-align: left;
	padding: 0px;
	margin-right: auto;
	margin-left: auto;
	width: 960px;
	border: 6px solid #333;
	zoom: 1;
	background-color: #fff;
	position: relative;
}
#header {
	background-color: #eee;
}
#content {
 
}
#footer {
	background-color: #eee;
}
/* Content Layout Rules
** You can add padding and margin to these internal wrappers
 */
#header #header_image {
	height: 80px;
}
#header #navigation {
	height: 20px;
	padding-left: 6px;
	padding-right: 6px;
	text-align: center;
}
#content #sidebar {
	padding: 6px;
}
#content #main_content {
	padding: 6px;
}
#footer #footer_content {
	padding: 6px;
	text-align: center;
}

HTML Code

This HTML code uses div tags rather than table code to create the layout of your web page. This single column layout is the basic structure for every web page design, and it is a good starting point for any design of your site.

<div id="wrapper">
  <div id="header">
  <div id="header_image">
  <!-- This is a placeholder image -->
  	<img height="80" width="960" alt="Your site title" title="Your site title" src="image.jpg" />
  </div>
    <div id="navigation">
      <div id="navcontainer">
        Horizontal navigation goes here
      </div>
    </div>
  </div>
  <div id="content">
    <div id="main_content">Content for  id "main_content" Goes Here</div>
  </div>
  <div id="footer">
  <div id="footer_content">
  Content for  id "footer_content" Goes Here
  </div>
  </div>
</div>

Click here to download the full HTML file for this template. The CSS code is in the head of the document.

This entry was posted in Web Design and tagged , , . Bookmark the permalink. Follow any comments here with the RSS feed for this post. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">