CSS Tables to Inherit
What CSS property will allow all of my cells in my table to separate (as in margin, I believe), without defining a class for all of the cells/rows? Am I able to do that with just a table property?
Thanks.
~Max
What CSS property will allow all of my cells in my table to separate (as in margin, I believe), without defining a class for all of the cells/rows? Am I able to do that with just a table property?
Thanks.
~Max
JeevesBond posted this at 18:38 — 1st May 2006.
He has: 3,956 posts
Joined: Jun 2002
Hmmm, the simplest way is:
td {
margin: 1em;
}
However, that will affect all td's on your page. Probably a better way is this:
<table id="tablewotholdsstuffandthat">
<tr>
<td> ... code ... </td>
</tr>
</table>
table#tablewotholdsstuffandthat td {
margin: 1em;
}
The second example will only select my really stupidly named table, instead of all td's in the entire document! If you have multiple tables of the same type, you could use classes:
<table class="typeoftablewotholdsstuffandthat">
<tr>
<td> ... code ... </td>
</tr>
</table>
table.typeoftablewotholdsstuffandthat td {
margin: 1em;
}
Generally, if you're only going to create one of something then use an id. If you're going to use multiples of the same item, use a class.
This should work in all web browsers and Internet Explorer too.
a Padded Cell our articles site!
ptpspptps0 posted this at 18:42 — 1st May 2006.
He has: 52 posts
Joined: Apr 2006
Thank you, sir. Much appreciated.
Megan posted this at 19:43 — 1st May 2006.
She has: 11,421 posts
Joined: Jun 1999
Isn't border-collapse and border-spacing meant to do the same thing? Unless I'm misreading you here. Border-spacing isn't supported by IE so maybe that's why you used margin instead???
See reference:
http://www.w3schools.com/css/css_reference.asp#table
Megan
Connect with us on Facebook!
ptpspptps0 posted this at 19:44 — 1st May 2006.
He has: 52 posts
Joined: Apr 2006
Why isn't CSS universal?
*gosh*
Renegade posted this at 09:31 — 2nd May 2006.
He has: 3,022 posts
Joined: Oct 2002
CSS more or less is universal. MSIE is just trying to create their own universe
JeevesBond posted this at 10:09 — 2nd May 2006.
He has: 3,956 posts
Joined: Jun 2002
Agreed. The CSS support in IE is awful, even IE 7 (the new one who's features were all stolen from Opera/Firefox) is equivalent to Opera 4 in terms of CSS support. Opera 4 was released in 2000 by the way.
This article makes for an interesting read about IE's CSS support, and how you as an author are about to be constrained: http://www.howtocreate.co.uk/operaStuff/acid/
a Padded Cell our articles site!
Megan posted this at 12:54 — 2nd May 2006.
She has: 11,421 posts
Joined: Jun 1999
So, you were using the margin instead of border-spacing to get around IE's lack of support, correct?
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.