Style Sheets
  Home arrow Style Sheets arrow Page 2 - Designing Web Pages without 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

Designing Web Pages without Tables
By: Sasha Slutsker
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 69
    2004-08-09

    Table of Contents:
  • Designing Web Pages without Tables
  • No Tables for Layout
  • Absolute Positioning, Add Borders and Margins
  • Lack of Browser Support

  • 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


    Designing Web Pages without Tables - No Tables for Layout


    (Page 2 of 4 )

    No Tables for Layout

    Tables were never meant for layout. They are supposed to be used for displaying tabular data such as athlete records or other information that goes into a table. For layout, you must use CSS. The <div> tag is a loosely defined block-level element made so that you can use CSS on your web page.

    Making Classes for the <div> Elements

    The first thing you need to do is define a CSS class which your <div> elements will use. This is how to do it:

    div.leftnav{

    background: white;

    color: black;

    /* Other display information here */

    /* Add Positioning information here */

    }

    This CSS class is rather simple and won't really do anything right now but define black text on white background. You must position the element somewhere on the page.

    Simple Relative Positioning

    This means that we just position an element where it is, without defining the exact location.

    div.leftnav{

    background: white;

    color: black;

    /* Other display information here */

    width: 15%;

    }

    What did we do? We said that the left navigation would be on the left wherever it is put on the page. This isn't bad, but for more flexibility, you might need absolute positioning. Also, it is important to note that what I just showed you was not real positioning (relative or otherwise.) All that was defined was the width so it will make an element that is 15% wide wherever is it on the page. It won't really position it anywhere. For real positioning, read on.

    More Style Sheets Articles
    More By Sasha Slutsker


       · Since ALL browsers use table consistently, and not all browsers use CSS...
       · You keep using tables, and the rest of us will take what you call a job. Oh, and if...
       · you are right to continue to use tables for now. A year or two down the road, CSS...
       · that's Netscape 4.7
       · Looks like tables are still good enough for Dev Shed sites.
       · I decided to put the table/css debate aside for a moment to try creating the css...
       · unless your designing for an intranet where you can control the browsers used, stick...
       · You need to add the CSS code that defines the content, rightnav, and leftnav...
       · Also, you can see an example of a site written in completely valid XHTML/CSS here:...
       · The Solar Conflict site is simple yet elegant. It taught me all I need to know to...
       · Yes you can make really good web sites with CSS : but if you want to know how to do,...
       · For my site, I've used the display: inline and display: table-cell commands, to get...
       · This site is "devoted" totally to css and shows how flexible it really can be in the...
       · I forgot exactly the code I used, but try something like border-margin:0; it could...
       · but it is aggravating that IE renders pages so differently than all the other...
       · 
       · It's easy to label developers that still use tables as ignorant and afraid of...
       · Actually I find that when I'm trying to make pages accessible CSS is more of a help...
       · Actually I find that when I'm trying to make pages accessible CSS is more of a help...
       · Um, Sasha, did you know your name reads Sasha Slut in the article listing? Call me...
       · The opening css design on "zen garden" renders terribly in IE5.0. To be specific,...
       · I'm curious. Am I the only one that uses CSS with tables? I used divs too, but it...
       · I too have seen the ramifications of IE being way to forgiving and Netscape seeming...
     

    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