css tables

He has: 10 posts

Joined: Oct 2005

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

He has: 698 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

Renegade's picture

He has: 3,022 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

demonhale's picture

He has: 3,278 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

He has: 3,956 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

She has: 11,421 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

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.