Style Sheets
  Home arrow Style Sheets arrow Page 4 - Creating DIV-based CSS Tables
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
STYLE SHEETS

Creating DIV-based CSS Tables
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 7
    2008-12-30

    Table of Contents:
  • Creating DIV-based CSS Tables
  • A three-column web page layout using a floating-div approach
  • Using CSS tables to create a two-column web document layout
  • Structural markup for a two-column web document layout

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Creating DIV-based CSS Tables - Structural markup for a two-column web document layout


    (Page 4 of 4 )

    I’m sure that the utilization of CSS tables to create a basic web page design will be better understood if you’re provided with the full CSS styles, along with the corresponding structural markup of this example. So, below I defined a single (X)HTML file that’s tasked with displaying this two-column layout:


    <!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 (2 columns)</title>

    <style type="text/css">

    body{

    padding: 0;

    margin: 0;

    background: #fff;

    }

    h2{

    margin: 0;

    font: bold 18px Arial, Helvetica, sans-serif;

    color: #000;

    }

    p{

    font: normal 12px Arial, Helvetica, sans-serif;

    color: #000;

    }

    #maincol, #sidebar{

    display: table-cell;

    }

    #tablewrapper{

    border-collapse: collapse;

    display: table;

    table-layout: fixed;

    }

    #sidebar{

    width: 20%;

    padding: 10px;

    background: #eee;

    }

    #maincol{

    width: 80%;

    padding: 10px;

    }

    </style>

    </head>

    <body>

    <div id="tablewrapper">

    <div id="sidebar">

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

    </body>

    </html>


    In addition to studying the source code listed above, you mat want to have a look at the following screen capture, which shows the visual appearance of sample web document:



    And finally, as usual with many of my articles on web development, feel free to use all of the code samples included into this tutorial, so you can arm yourself with a thorough grounding in using CSS tables.

    Final thoughts

    In this first chapter of the series, I walked you through the development of a simple web page layout with CSS tables, which was comprised of two main columns. As you saw earlier, this approach permits us to easily place the containers of a web document as true table elements, which can be much more intuitive than using floating divs.

    In the upcoming article, I’ll be teaching you how to use the functionality of CSS tables, this time for building a three-column web page layout. Thus, now that you know what this forthcoming tutorial will be about, you don’t have any excuses 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.

       · CSS tables might be over time a great improvement in the way web page are created....
     

    STYLE SHEETS ARTICLES

    - Image Replacement CSS Techniques
    - Using BlueTrip`s Success, Notice and Error C...
    - More Uses for the Thin and Caps CSS Classes ...
    - Styling Definition Lists with the BlueTrip C...
    - Styling Unordered and Ordered HTML Lists wit...
    - Using the BlueTrip CSS Framework`s Thin and ...
    - Adding Borders to Web Page Columns with Blue...
    - Introducing the BlueTrip CSS Framework
    - Using a Background Grid to Assist Web Page L...
    - Extending the Rule Of Thirds for Web Page La...
    - A Two-Column Web Page Layout Based on the Ru...
    - Using the Rule Of Thirds for Web Page Layout
    - Swapping Columns Using the Divine Ratio for ...
    - Using the Golden Ratio in Liquid Web Page De...
    - Fundamental Design Principles for Web Page L...







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek