justuptime.com - monitor your servers & websites

css tables

You are viewing this site as a guest. Join our community to get your questions answered and share knowledge. Active members may advertise and ask for a website critique.

He has: 10 posts

Joined: Oct 2005

Does anyone know how to make tables using css?
Is it possible?

He has: 582 posts

Joined: Jul 2005

Sure, just add a class name to your table, like this:

<table class="table1">
...
</table>

'

Then, in your CSS file, do the following:

.table1 {
(attributes)
}

'

Just like you would any other tag. Wink

-Kurtis
~View (and vote for) my art at BrickFish!

Renegade's picture
Moderator

He has: 2,944 posts

Joined: Oct 2002

Or, if you're talking about making a table with just CSS and DIVs, you can do this:

<div class="row">
  <div class="cell">Cell 1</div>
  <div class="cell">Cell 2</div>
</div>

<div class="row">
  <div class="cell">Cell 1</div>
  <div class="cell">Cell 2</div>
</div>

'

And the CSS:

.row {
  display:table-row;
}
.cell {
  display:table-cell;
}

'

Not too sure if I got the CSS right, and if I did, it doesn't work in IE - as expected, it will work in Firefox though, and possibly Opera too. Smiling

Cheng Eu Chew - Renegade
Download:
- Mozilla, Firefox
- Opera
This post may contain peanut traces

demonhale's picture

He has: 3,301 posts

Joined: May 2005

or read the thread about css and tables...

He has: 10 posts

Joined: Oct 2005

Thanks.
I'll make good sue of this knowledge.

JeevesBond's picture
Moderator

He has: 3,711 posts

Joined: Jun 2002

Hmmm, I'm a little confused about exactly what you're trying to do here Zaberfang, are you trying to make a table using CSS or change the formatting of a table using CSS?

The first isn't possible, but the second is. CSS is purely for formatting markup (i.e. HTML), it's not like JavaScript where you can script tables on the fly (not that I'd recommend anyone does this - it's horribly slow Smiling )

a Padded Cell our articles site!

Megan's picture
Administrator

She has: 10,304 posts

Joined: Jun 1999

Why would you need to use divs to "make" a table?? Tables are tables, divs are divs. No reason to turn a table into divs Confused Unless, of course, it was never supposed to be a table in the first place but then why would you need the CSS to define it as table elements?

There are some neat things you can do with tables using CSS:

http://www.w3schools.com/css/css_reference.asp#table