How do you set margin in a TD?

J

Jibba Jabba

Been trying the whole night but just can't set a left margin for a TD using
CSS. Can someone help me with this? I've searched google and tried
margin-left, margin, etc. and not are doing it. Help!
 
G

GD

Jibba Jabba said:
Been trying the whole night but just can't set a left margin for a TD
using CSS.

Margins only apply to the outer table, not cells. Padding only applies
to cells, not the outer table.

Cellspacing (what you're after) is done in CSS using the border-spacing
property, however MSIE doesn't support it (as usual):


table {
margin:1em 5%;
border:black thick solid;
border-spacing:2em 0.25em;
}

th,td {
padding:0.25em;
border:black thin solid;
}

As an aside, another property for the outer table is border-collapse.
This collapses the borders throughout the whole table and is supported
from IE6 (though maybe IE5.5 supports it too?). You would use this
property *instead* of border spacing:

table {
margin:1em 5%;
border:black thin solid;
border-collapse:collapse;
}
 
L

Leif K-Brooks

Jibba said:
Been trying the whole night but just can't set a left margin for a TD using
CSS. Can someone help me with this? I've searched google and tried
margin-left, margin, etc. and not are doing it. Help!

Table cells don't have margin. A wild guess says you want padding.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top