Table or Div ,Which is best to show the records?
Posted: Mon, 2008-05-12 07:35
I am working on CSS Layout. I need to show some records in it. I feel "Table" is the best choice to show records or data. But My Team Lead says that no need to show tables for records. So Please help us to know which is the best choice to show the record . Table or CSS div ?


Enthusiast
Posts: 409
Joined: 2005-08-06
Location: Kent, UK
Hi there. My understanding
Posted: Mon, 2008-05-12 07:48
Hi there.
My understanding of tables is that if you use tables for design/layout purposes then that is wrong. If on the other hand you use them for displaying records/data then that is what they were intended for, (tabular data).
What smell? that wasn't me
http//www.about-gravesend.co.uk ,
http//www.lordofchaos.co.uk
newbie
Posts: 2
Joined: 2008-05-12
Location: chennai
Can you tell me why not CSS
Posted: Mon, 2008-05-12 07:52
Can you tell me why not CSS to show the tabular data?
Moderator
Posts: 5577
Joined: 2005-02-22
Tables and CSS aren't
Posted: Mon, 2008-05-12 10:10
Tables and CSS aren't mutually exclusive and they aren't competitors. CSS v Tables is mislabelling of what should be properly called "semantic html", that is placing your content in the most appropriate HTML elements. Its necessary because visual browsers (e.g. FF, IE) aren't the only way to access the web. To get an idea of why this is important, grab yourself a screen reader and listen to it read a page that has been laid out uses the typical nested table structure that was common to the web a few years ago.
Tables elements (TABLE, THEAD, TBODY, TFOOT, TR, TH, TD, COL, COLGROUP) are a rich set of HTML elements for displaying tabular data. Its silly to try and squeeze tabular data into other HTML elements. Screen readers and other non-visual UAs are fine with tables used in this manner.
CSS is a syntax for describing the presentation of HTML elements. It applies equally well to table elements as it does to any other element.
The #1 characteristic for determining if you need a table is does the data require column headings. Table elements are the only elements in HTML that can properly relate column headings to column content. If you were to use any other HTML structure the column headings should appear with each item.
e.g.
name: widget
available colours: red, green, blue
weight: 1kg
cost: $1.00
name: small widget
available colours: silver, gold, black
weight: 100g
cost: $0.50
as opposed to a table
name available weight costcolours
---------------------------------------------------
widget red, green, blue 1000g $1.00
small widget silver, gold, black 100g $0.50
---------------------------------------------------
If you really, really want to, you can duplicate the appearance of a table using other elements, but honestly don't bother.
On Having Layout | The One True Layout | menus by listamatic
Enthusiast
Posts: 201
Joined: 2008-03-16
W3C
Posted: Mon, 2008-05-12 11:11
The word tabular data already includes the word table. W3C says about tables: The HTML table model allows authors to arrange data. There is nothing wrong with tables when they are used to display data. I have the feeling people understand tableless wrong. It does not mean, use a table and you're dead or you'll be damned in hell, it means do not use table for designing purposes.