Forum Moderators: not2easy

Message Too Old, No Replies

Combining Tables with CSS

         

ziggy

8:32 pm on Sep 13, 2008 (gmt 0)

10+ Year Member



Hi all,

I am looking for an example where css and tables are used together. I have to update a webpage whose template uses tables for the layout of the page.

I cant make any changes to the template i can only add content to the body of the template.

The content i would like to add will come from a database and its tabular data so to make it easy i would like to use tables to display the data.

I dont want to use tables to layout the data. Is it possible to use css/div tags to position the html table wherever i want on the screen?

The final page will contain four boxes. one for a form. A box just below it will contain the tabular data and a box on the right will also contain data.

What i would like is an example of how div tags have been used to position tables that contain data.

thanks

swa66

9:05 pm on Sep 13, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sure, you can position a table just like any other html element.

You have some unique properties that youcan apply on tables to render them.
"border-collapse:collapse" simplifies the borders a lot.
"empty-cells:show" makes empty cells show up in a table.

If different cells in a table have different borders, in a collapsed model there is a resolution algorithm to choose the right one. It's important to note "border-style:hidden" has priority over the other border style, a "detail" IE implements incorrectly.

Should nth-child and similar pseudo classes be supported, you could do nice odd/even alternating background colors.

More info, examples and drawings:
[w3.org...]

Tip: skip over section 17.2 in a first reading, it'll confuse you (deal with applying table layout to things that are not a table, not what you seek anyway).

rocknbil

2:38 pm on Sep 14, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I dont want to use tables to layout the (tablular) data.

This is what tables are for. The opposition of tables for layout is just that, but it's perfectly semantic to output tabular data in a table.

ziggy

12:17 pm on Sep 15, 2008 (gmt 0)

10+ Year Member



Sorry i meant i wanted to use table to layout the data.

Anyway thanks guys for your help. I've been experimenting a bit. See below [webmasterworld.com...]

Thanks