PDA

View Full Version : putting "cellspacing='0' cellpadding='0'" into CSS



jl9148
Nov 18th, 2006, 09:36 PM
how can i define this --> cellspacing='0' cellpadding='0' in my style sheets?
ive tried style='cellspacing: 0; cellpadding: 0;' but it didnt work.

help anyone?

ahallicks
Nov 18th, 2006, 09:49 PM
I could guess at simply putting




table {
padding: 0px;
}

tr {
padding: 0px;
}

td {
padding: 0px;
}



????

VIPStephan
Nov 18th, 2006, 11:19 PM
td {
margin: 0;
padding: 0;
}

is sufficient.

However, after close attention to detail you'll notice that you will still need the ol' HTML attributes for IE 6. But I think it's still valid (X)HTML strict.

Arbitrator
Nov 19th, 2006, 12:18 AM
how can i define this --> cellspacing='0' cellpadding='0' in my style sheets?
ive tried style='cellspacing: 0; cellpadding: 0;' but it didnt work.

help anyone?The CSS equivalents of the cellpadding and cellspacing attributes are the padding and border-spacing properties.

Unlike as with the cellpadding attribute, you would apply the padding property to the the table cells, not the table.

Internet Explorer doesnít support the border-spacing property. Thus a commonly used alternative is the border-collapse property which Internet Explorer does support. This property is applied to the table itself. The border-collapse: collapse declaration will set the cell spacing to zero and collapse the resulting doubled borders into a single border; usually the desired behavior when border-spacing is zero. This means, however, that you canít set the cell spacing to anything other than zero or the default if you intend to support Internet Explorer in this regard.

Example CSS:

table { border-collapse: collapse; }
td { padding: 0; }