Home arrow Style Sheets arrow Page 4 - Styling Headers, Paragraphs and Main Columns of DIV-Based CSS Tables
STYLE SHEETS

Styling Headers, Paragraphs and Main Columns of DIV-Based CSS Tables


If you’re a web designer who uses a few divs to create the layouts of the pages that comprise your web sites, then this group of articles might be useful to you. You'll be particularly interested if you want to keep up with the new trends of modern web development. In this article series, you’ll find an approachable guide to using CSS tables to build table-less web document layouts, without floating containers or negative margins.

Author Info:
By: Alejandro Gervasio
Rating: 4 stars4 stars4 stars4 stars4 stars / 3
January 13, 2009
TABLE OF CONTENTS:
  1. · Styling Headers, Paragraphs and Main Columns of DIV-Based CSS Tables
  2. · Review: building a basic three-column web page layout with CSS tables
  3. · Styling main divs, paragraphs, and headers
  4. · The complete source code of the three-column web page

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
Styling Headers, Paragraphs and Main Columns of DIV-Based CSS Tables - The complete source code of the three-column web page
(Page 4 of 4 )

As I anticipated in the previous section, below I included the complete source code of the web page built in the beginning, this time incorporating the additional CSS styles created before. Here it is:


<!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>Example of div-based web page layout using CSS tables (some elements are basically styled)</title>

<style type="text/css">

body{

padding: 0;

margin: 0;

background: #fff;

}

h2{

margin: 0;

font: bold 14pt Arial, Helvetica, sans-serif;

color: #036;

}

p{

font: normal 11px Tahoma, Arial, Helvetica, sans-serif;

color: #333;

}

#tablewrapper{

border-collapse: collapse;

display: table;

table-layout: fixed;

}

#navbar, #maincol, #sidebar{

display: table-cell;

}

#navbar{

width: 20%;

padding: 15px;

background: #ccf;

}

#maincol{

width: 50%;

padding: 15px;

background: #eee;

}

#sidebar{

width: 30%;

padding: 15px;

background: #9cf;

}

</style>

</head>

<body>

<div id="tablewrapper">

<div id="navbar">

<h2>This is the left column of the web page</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 id="maincol">

<h2>This is the center column of the web page</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 id="sidebar">

<h2>This is the right column of the web page</h2>

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

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

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

</div>

</div>

</body>

</html>


A final reminder before you finish reading this tutorial: if you’re planning to test the above example on your own machine, don’t forget that it won’t work with Internet Explorer 7 and below, since it lacks  adequate support for CSS tables. Naturally, Mozilla Firefox and other standards-compliant browsers will render the tables as expected.

Final thoughts

In this third part of the series, I demonstrated how to improve, at a basic level, the visual appearance of the previous web page, which was created with CSS tables. Obviously, this process is very simple to grasp, and doesn’t require additional explanation.

However, it’s possible that at this moment you’re wondering how to add a header and a footer sections to the web page. That’s a good question, but if you want to know the answer, you’ll have to read the upcoming article!


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 3 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials