www.webdeveloper.com
Results 1 to 15 of 15

Thread: What are good reasons for nesting table and

  1. #1
    Join Date
    Oct 2005
    Posts
    84

    What are good reasons for nesting table and

    What are good reasons for nesting table and what are some concerns when nesting talbes

  2. #2
    Join Date
    Nov 2002
    Location
    XYZZY - UK
    Posts
    1,760
    The good reasons for nesting TABLE elements are ZERO! - Unless you mean Laziness.

    The bad reasons for doing so are very common there are a variety of concerns it slows the browser; it detrimentally affects layout, causes bloat, is less powerful than CSS, etc…
    Last edited by Robert Wellock; 11-21-2005 at 12:10 PM.

  3. #3
    Join Date
    Nov 2002
    Location
    Baltimore, Maryland
    Posts
    12,279
    From the HTML 4.01 Specification:
    Tables should not be used purely as a means to layout document content as this may present problems when rendering to non-visual media. Additionally, when used with graphics, these tables may force users to scroll horizontally to view a table designed on a system with a larger display. To minimize these problems, authors should use style sheets to control layout rather than tables.
    “The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
    —Tim Berners-Lee, W3C Director and inventor of the World Wide Web

  4. #4
    Join Date
    Mar 2004
    Posts
    3,081
    Well to be honest, I can't think of any reasons to nest tables. A concern of doing so would be that your documents wouldn't make any sense.
    I'm thuper, thanks for asking.

    It lives! http://www.stephenphilbin.com/ (Well it kinda' does anyway).
    My portable colour selection tool

  5. #5
    Join Date
    Nov 2003
    Location
    Jerryville, Tejas
    Posts
    11,715
    As you all know, I really hate to be a contrarian here but one real reason for nesting tables would be to mark up some hierarchical data structure like a list of purchase orders, each with their list of line items.

  6. #6
    Join Date
    Jul 2003
    Location
    New York City
    Posts
    2,771
    Quote Originally Posted by ray326
    As you all know, I really hate to be a contrarian here but one real reason for nesting tables would be to mark up some hierarchical data structure like a list of purchase orders, each with their list of line items.
    I don't know. A table in a table? I've never seen anything like that in print. It's just too jumbled. Maybe a list of tables, but never a table of tables.

  7. #7
    Join Date
    Mar 2005
    Location
    CA
    Posts
    323
    ray hit the point I was going to make. There is legitimate table data which can be very beneficial to use nested tables.

    If you are using them to provide layout structure to your site, bad idea. If you have information which is best conveyed in a multiple-table format then do so.

  8. #8
    Join Date
    Mar 2005
    Location
    CA
    Posts
    323
    Quote Originally Posted by MstrBob
    I don't know. A table in a table? I've never seen anything like that in print. It's just too jumbled. Maybe a list of tables, but never a table of tables.
    Code:
    Item                  Item Price
     -Item Upgrade     -Upgrade price
     -Item Upgrade     -Upgrade price
    Where you have a table surrounding tables of data. This is a basic nesting situation (this one would be better suited to using lists as well, I believe), but there are deeper levels of heirarchy where the nesting comes in handy.

  9. #9
    Join Date
    Jul 2003
    Location
    New York City
    Posts
    2,771
    Quote Originally Posted by acorbelli
    Code:
    Item                  Item Price
     -Item Upgrade     -Upgrade price
     -Item Upgrade     -Upgrade price
    Where you have a table surrounding tables of data. This is a basic nesting situation (this one would be better suited to using lists as well, I believe), but there are deeper levels of heirarchy where the nesting comes in handy.
    Well, of course your demonstration was just that of a basic, non-nested table, so I'm a little confused. I'm not trying to be stubborn here, but I really can't think of a situation where having nested data tables would be beneficially or neccessary. (Because as we all know here, our tables should only be data tables).

  10. #10
    Join Date
    Mar 2005
    Location
    CA
    Posts
    323
    Quote Originally Posted by MstrBob
    Well, of course your demonstration was just that of a basic, non-nested table, so I'm a little confused. I'm not trying to be stubborn here, but I really can't think of a situation where having nested data tables would be beneficially or neccessary. (Because as we all know here, our tables should only be data tables).
    Okay, sorry, I wasn't quite clear enough.

    Code:
    Item                                  Item Price
    ---------------------------------------
    '61 Chevy                          |$400
     -A/C                            |$45
     -Power Locks                |$20
    ---------------------------------------
    '76 Ford                            |$10
    ---------------------------------------
    '99 Dodge                          |$450
     Passenger SRS              |$0.00
    ---------------------------------------
    Does that sort of make more sense? Where you have a table (cars, prices) with other tables inside (upgrades and their prices and information).

    Sorry, it makes a lot of sense to me having done complicated invoices in this method before (where nested information just looks better this way).

  11. #11
    Join Date
    Jul 2003
    Location
    New York City
    Posts
    2,771
    Ahh, I see. But given that example, why not just use multiple <tbody> ?

  12. #12
    Join Date
    Nov 2002
    Location
    Baltimore, Maryland
    Posts
    12,279
    See http://www.w3.org/TR/html401/struct/tables.html . HTML tables have all kinds of ways of organizing data multi-dimensionally.
    “The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
    —Tim Berners-Lee, W3C Director and inventor of the World Wide Web

  13. #13
    Join Date
    Mar 2005
    Location
    CA
    Posts
    323
    Quote Originally Posted by MstrBob
    Ahh, I see. But given that example, why not just use multiple <tbody> ?
    Multiple reasons, the best one I can think of is that still doesn't quite get the strict arrangement necessary for someone who might want to deliberately delineate sets of data with borders and padding in ways that the tbody thead tfoot tags won't allow you to do.

    I've never personally used a tbody, but from the looks of it I can imagine that if I were to be writing an invoice for download (in HTML format? I don't know why) the tbody would not work for me.

  14. #14
    Join Date
    Nov 2002
    Location
    Baltimore, Maryland
    Posts
    12,279
    Quote Originally Posted by acorbelli
    I've never personally used a tbody...
    If you've ever used a TABLE in HTML 4.01 then you've used a TBODY. It's there with or without the tags.
    “The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
    —Tim Berners-Lee, W3C Director and inventor of the World Wide Web

  15. #15
    Join Date
    Mar 2005
    Location
    CA
    Posts
    323
    Quote Originally Posted by Charles
    If you've ever used a TABLE in HTML 4.01 then you've used a TBODY. It's there with or without the tags.

    Okay then, to clarify, I've never specified tbody tags in any of my tables...

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles