Forum Moderators: not2easy

Message Too Old, No Replies

Table in a div, or css in a table?

         

Webber

1:38 pm on Dec 3, 2007 (gmt 0)

10+ Year Member



I like to use css to create my layout. And I use it to create a simple layout with a header, footer, navigation, and content. These will be same for every page. In the content div, however, things might vary. Do I put a small table in this div? Or is it better to do everything the other way around? A table for the whole layout and using css or php for the headers and footers and more.

What would be better for me when I am updating and expanding the site? And what would be better for accessibility, etc?

varya

2:52 pm on Dec 3, 2007 (gmt 0)

10+ Year Member



I use CSS for everything, unless I'm displaying a data table.

CSS gives you loads more flexibility. On one of my sites, I wanted to flip the navigation panels on the right and left sides of the page. It took me less than a minute to do it by making the change in my style sheet. If the site had been in tables, I would have had to edit every single page.

Tables are not very good for accessibility. Screen readers read across the data cells, not in the order you can visually see the content.

Xapti

6:40 am on Dec 4, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Tables should be used for tabular data. Tabular data can be as simple as 2 column data, such as table of contents, or also things like forum thread listings (but forum posts themselves I disagree to be tabular data), and calenders.

For layout purposes, you should really use only styled divs. It's called semantic coding, and it's useful for more than just semantics. There are many advantages to using div-based layouts; someone already mentioned that accessibility is a big one, but it's also less markup, more convenient & easier to edit dimensions and positioning, and other things.

Webber

2:51 pm on Dec 6, 2007 (gmt 0)

10+ Year Member



Then you would use multiple style sheets, right?
It this easy to manage?

varya

4:31 pm on Dec 6, 2007 (gmt 0)

10+ Year Member



What is it you're thinking you'll use multiple style sheets for?

I generally only use one for screen display (I also always use print style sheets).

amt1ect

5:47 pm on Dec 6, 2007 (gmt 0)

10+ Year Member



With CSS, you only need one .css file for the whole website, the only think you need to do is: insert the reference link to the css file on each page you want to have that style you have created.