Click to See Complete Forum and Search --> : cellpadding + cellspacing
SearedIce
04-14-2003, 10:03 AM
how do i set cellpadding+cellspacing in css?
...once i know the right css thing to set for it...if i put it in the body thing (like body {color: #123456}) will it change all the tables' cellpaddings and cellspacings?
thanx,
john
gil davis
04-14-2003, 10:34 AM
Table cellpadding and cellspacing are not CSS attributes, they are HTML attributes.
If you set "padding" in the BODY, a table will not inherit that style, anyway. You can set "padding" on the TD or the TH.
I'm not sure of the relationship of cellspacing and border-width + margin + padding, but I'm sure you could get it to look like you want it to look by playing with those style variables.
SearedIce
04-14-2003, 11:08 AM
thanx...i wasn't sure if it existed (i've never seen it)
i just thought it would help tidy up my code...i could get rid of all those long "cellpadding=0 cellspacing=0" attributes in the 3 tables i have
thanx again,
john
jeffmott
04-14-2003, 11:23 AM
<style type="text/css">
table
{
border-collapse: collapse;
}
td, th
{
margin: 0;
padding: 0;
}
</style>
SearedIce
04-14-2003, 11:26 AM
Thanx!
...i didn't know you could change multiple tag's css by using the comma *takes a note*
what's that collapse mumbo jumbo?
p.s. what's your signature supposed to mean?
sscarfo
05-13-2006, 01:15 PM
Id been looking for the solution posted by jeffmott for a while, it looks like the border-collapse function makes all the difference... just like the manual says :)
from www.w3.org/
The various border properties apply to columns only if 'border-collapse' is set to 'collapse' on the table element. In that case, borders set on columns and column groups are input to the conflict resolution algorithm that selects the border styles at every cell edge.
This css made it for me (set cellpadding and cellspacing to 0 on all tables), whats the difference?
table {
border-collapse: collapse;
margin: 0;
}