HTML
  Home arrow HTML arrow Page 5 - HTML, CSS and Tables: The Beauty of Data
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 
Sun Developer Network 
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? 
HTML

HTML, CSS and Tables: The Beauty of Data
By: Chris Heilmann
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 67
    2004-11-17

    Table of Contents:
  • HTML, CSS and Tables: The Beauty of Data
  • What is a table?
  • W3C to the rescue
  • Summary needed
  • Styling tables: the days of the spacer GIF
  • Embracing CSS and separating "what is what" and "what it looks like"
  • Our CSS

  • 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


    HTML, CSS and Tables: The Beauty of Data - Styling tables: the days of the spacer GIF


    (Page 5 of 7 )

    In the old days of Web design, a table was styled with visual elements and attributes--markup that defined how something looks rather than what it is. As CSS was not yet defined, and browsers rendered attributes differently, we were forced to create lines, margins and paddings with "spacer" images--transparent GIFs that allowed us to set a width and height to their parent elements and allow the background colour to shine through.

    This resulted in huge tables, both concerning line count and file size, and changes had to be repeated in each document. Our example table using spacer GIFs turns out to be almost 10KB and 215 lines of HTML markup.

    Out with the spacer GIF - in with the (now deprecated) attributes

    When the browsers of the third generation mercifully went the way of the Dodo bird, we were able to use HTML properties more cleverly to avoid all the overhead of spacer images. Padding and spacing together with a clever use of background colour allowed us to cut down our table to become roughly 2KB and 35 lines of markup. Yet we still had to replicate the color information and padding for each table and each table element.

    CSS to the rescue

    With the 5th (and partly 4th) generation of MSIE coming out, we were able to use CSS properly for the first time. CSS allows us to keep the visual presentation information in a single file that gets applied to all the HTML documents. Changes can be applied a lot easier that way and we can keep the HTML free of presentational elements and attributes.

    Sadly enough, however, a lot of developers didn't grasp that these newer browsers also support the aforementioned "new" table elements and attributes, and simulated these by applying classes to each element. These tables suffering from "classitis" failed miserably in conveying the flexibility of CSS. Classes became the new font tags. This is still the case for a lot of WYSIWYG tools these days. Our example table suffering from classitis amounts to about 700 bytes of CSS and 1.3K of HTML data in 44 lines.

    More HTML Articles
    More By Chris Heilmann


       · The article is only the start. I hope some of you might be tempted to go on...
     

    HTML ARTICLES

    - Using a 3D HTML Table as a Recordset
    - Building a 3D HTML Table
    - Maximizing and Restoring HTML Images: Layer ...
    - Completing Construction of a Database Form w...
    - Maximizing and Restoring Images in a Tabular...
    - Building the Recordset for an HTML Database ...
    - Laying Out a Database Form with HTML
    - Tabular Database Form Functions with HTML
    - Tabular Database Forms with HTML
    - Using the Find Functions for HTML Database F...
    - Sorting for Database Forms with HTML
    - Edit and Other Database Form Functions with ...
    - More Database Form Functions with HTML
    - Database Form Functions with HTML
    - Using the HTML Table Element as a Recordset






    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
    Stay green...Green IT