Home arrow Style Sheets arrow Page 4 - Constructing Fixed Layouts with a Simple CSS Framework
STYLE SHEETS

Constructing Fixed Layouts with a Simple CSS Framework


If you’re searching for a guide to creating an extensible CSS framework that lets you build different web page layouts, you’ve come to the right place. Welcome to the third installment of a four-part series on building a simple CSS framework. This series walks you through creating a basic CSS framework which will help you to construct both liquid and fixed web designs very quickly, without having to spend endless, annoying hours coding multiple style sheets.

Author Info:
By: Alejandro Gervasio
Rating: 5 stars5 stars5 stars5 stars5 stars / 3
March 05, 2009
TABLE OF CONTENTS:
  1. · Constructing Fixed Layouts with a Simple CSS Framework
  2. · Review: working with liquid web page layouts
  3. · Adding a file to the CSS framework for fixed designs
  4. · Building a two-column fixed web page layout

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
Constructing Fixed Layouts with a Simple CSS Framework - Building a two-column fixed web page layout
(Page 4 of 4 )

In the previous section, I added a new CSS file to the framework to provide it with the capacity to build fixed web layouts in a truly effortless way. The best way to understand how this file can be used, however, is through a concrete example.

Therefore, in the following lines I coded a sample (X)HTML file. It will display on screen a two-column web document, using the improved functionality of this CSS framework. Here’s the file:


<!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">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title>Fixed layout 2 columns</title>

<link rel="stylesheet" type="text/css" href="reset.css" />

<link rel="stylesheet" type="text/css" href="fixedlayout_2cols.css" />

</head>

<body>

<div id="header">

<h2>This is the header section of the web page</h2>

<p>Contents for header section go here. Contents for header section go here. Contents for header section go here. Contents for header section go here.</p>

</div>

<div id="navbar">

<h2>This is the navigation bar of the web page</h2>

<ul>

<li><a href="#">Link 1</a></li>

<li><a href="#">Link 2</a></li>

<li><a href="#">Link 3</a></li>

<li><a href="#">Link 4</a></li>

<li><a href="#">Link 5</a></li>

<li><a href="#">Link 6</a></li>

</ul>

</div>

<div id="mainwrapper">

<div id="leftbar" class="leftcol">

<div class="box">

<div class="title">SECTION TITLE</div>

<div class="content">

<h2>Header goes here.</h2>

<p>Contents for left column go here. Contents for left column go here. Contents for left column go here. Contents for left column go here. Contents for left column go here. Contents for left column go here. Contents for left column go here. Contents for left column go here. Contents for left column go here. Contents for left column go here.</p>

</div>

</div>

<div class="box">

<div class="title">SECTION TITLE</div>

<div class="content">

<h2>Header goes here.</h2>

<p>Contents for left column go here. Contents for left column go here. Contents for left column go here. Contents for left column go here. Contents for left column go here. Contents for left column go here. Contents for left column go here. Contents for left column go here. Contents for left column go here. Contents for left column go here.</p>

</div>

</div>

</div>

<div id="centerbar" class="leftcol">

<div class="box">

<div class="title">SECTION TITLE</div>

<div class="content">

<h2>Header goes here.</h2>

<p>Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here.</p>

<p>Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here.</p>

<p>Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here.</p>

</div>

</div>

<div class="box">

<div class="title">SECTION TITLE</div>

<div class="content">

<h2>Header goes here.</h2>

<p>Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here.</p>

<p>Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here.</p>

<p>Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here. Contents for center column go here.</p>

</div>

</div>

</div>

</div>

<div id="footer">

<h2>This is the footer section of the web page</h2>

<p>Contents for footer section go here. Contents for footer section go here. Contents for footer section go here. Contents for footer section go here. Contents for footer section go here.</p>

</div>

</body>

</html>


See how easy it is to construct a fixed web page layout using the CSS framework? I bet you do! As illustrated above, the sample (X)HTML file is composed of two main columns, which also include a few generic containers and some title sections as well.

Other than that, naturally the most important thing to stress here is that the structural markup incorporates only minor changes, since the layout has been built only by including the appropriate CSS file. That’s pretty good!

Finally, to complete the previous explanation, below I included a screen shot that shows the visual appearance of the recently created fixed design. Take a look at it, please:



Now that you've grasped how this CSS framework has been used to construct a simple two-column fixed design, feel free to tweak the source files, so you can start adding new features to it. Only your imagination is the limit!

Final thoughts

In this third chapter of the series, I provided the CSS framework with the capability to construct fixed web page designs, certainly something that was pretty easy to achieve, since the incorporation of this important feature only demanded coding a basic CSS file, and nothing else.

In the last part, I’m going to show you how to use the framework to build a fixed layout that will be composed of three primary columns, in this way completing this hopefully educational series of articles.

Now that you’ve been warned about the topics that will be discussed in the final tutorial, you won’t want to miss it!


DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

blog comments powered by Disqus
STYLE SHEETS ARTICLES

- CSS Combinators: Working with Child Combinat...
- CSS Combinators: Using General Siblings
- Intro to CSS Combinators
- CSS Semicircles and Web Page Headers
- Drawing Circular Shapes with CSS3 and Border...
- More CSS Pagination Link Templates
- CSS Pagination Links
- Animated CSS3 Image Gallery: Advanced Transi...
- CSS3 Animated Image Gallery: Transitions
- CSS3 Properties: Fixed Heights with box-sizi...
- CSS3 Properties: Altering Strokes and 3D Eff...
- CSS3 Properties: Text-Stroke
- CSS3 Transitions: Width and Height Properties
- Creating a Drop Down Menu in CSS3
- Intro to CSS Transitions

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 10 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials