JavaScript
  Home arrow JavaScript arrow Building Zebra Tables with CSS and JavaScr...
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  
Dedicated Servers  
Moblin 
JMSL Numerical Library 
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? 
JAVASCRIPT

Building Zebra Tables with CSS and JavaScript
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 6
    2008-06-11

    Table of Contents:
  • Building Zebra Tables with CSS and JavaScript
  • Building zebra tables with a server-side scripting language
  • Creating a zebra table using CSS and some basic structural markup
  • Creating a zebra table by styling only its even rows

  • 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


    Building Zebra Tables with CSS and JavaScript


    (Page 1 of 4 )

    This is the first article in a four-part series that will teach you how to build basic zebra tables using CSS, server-side scripting languages, and JavaScript. If this interests you in any way, I strongly advise you to start reading...NOW!

    Nowadays, many web designers are starting to build web sites by using DIV-based layouts exclusively, and they only pull the venerable tables out of their toolbox when it comes to displaying tabular data. True to form, creating web pages with the table-less approach is a trend that's growing rapidly over time, as more and more web developers stick to the standards recommended by the W3 Consortium.

    Naturally, because this scenario favors DIVs, tables are erroneously considered by many to be the evil player of the game. However, as I said in the beginning, they're helpful for showing tabulated information on web pages.

    As with other elements in a web document, tables can be styled in all sorts of clever ways to make them look fancy and professional before the eyes of different users, which is something that you've probably done hundreds of times. This concept obviously brings up the subject of this series of articles (weird, but it looks like everything has to do with tables!). Yes, one of the most common techniques used to style tabular data on a web page is "zebra tables."

    Before you start making jokes about "monkey web forms" or "dog DIVs," let me tell you what a zebra table is. In layman's terms, zebra tables are tables whose respective odd and even rows are displayed using alternated background colors. Now, do zebra tables sound familiar to you? I bet they do, since they're currently used by many modern web sites as an elegant method to display product catalogs, forecast information, real estate data, etc.

    Of course, there are several approaches that can be used to construct zebra tables with relative ease, ranging from pure CSS and simple structural markup, to utilizing a server-side scripting language like PHP to dynamically generate the respective odd and even rows. Nevertheless, in this series of articles, not only am I going to teach you how to build basic - yet fancy -- zebra tables by way of distinct methodologies, but also how to facilitate their creation with a small pinch of JavaScript.

    Hopefully, by the end of this series, you will be armed with a decent background in building zebra tables using both client- and server-side approaches. Therefore, before I end up knocking the doors off the zoo, let's move on and start discovering the hidden magic of building zebra tables! Here we go!

    More JavaScript Articles
    More By Alejandro Gervasio


       · Zebra tables are an elegant way to display tabular data on web pages. Though, it’s...
       · Where is the Javascript ?
       · Thank you for commenting on my article. As mentioned in the last section of this...
     

    JAVASCRIPT ARTICLES

    - Book Review: Learning the Yahoo! User Interf...
    - Dynamically Generate a Selection List in a R...
    - Intergrate DWR into Your Java Web Application
    - Detect Browser Compatibility with the Reques...
    - Using the EXT JS Date Picker Widget
    - Ajax Hack for Entering Information Without R...
    - EXT JS 2.1 Overview
    - Using the Style Object for Zebra Tables with...
    - Binary Searching
    - An Improved Approach to Building Zebra Tables
    - Assigning Background Colors Dynamically to Z...
    - Building Zebra Tables with CSS and JavaScript
    - JavaScript: Array Objects
    - A Closer Look at Smart Markers with Yahoo! M...
    - Using Polylines and Smart Markers with Yahoo...







    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway