How do you set margin in a TD?

Discussion in 'HTML' started by Jibba Jabba, Feb 13, 2004.

  1. Jibba Jabba

    Jibba Jabba Guest

    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!
     
    Jibba Jabba, Feb 13, 2004
    #1
    1. Advertising

  2. Jibba Jabba

    GD Guest

    Jibba Jabba <> wrote:
    > 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;
    }
     
    GD, Feb 13, 2004
    #2
    1. Advertising

  3. Jibba Jabba wrote:
    > 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.
     
    Leif K-Brooks, Feb 13, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. f
    Replies:
    5
    Views:
    100,737
    thebeacon
    Jul 16, 2006
  2. rosdi
    Replies:
    9
    Views:
    44,851
    lalalalala64
    Jun 10, 2011
  3. Cal Who
    Replies:
    1
    Views:
    441
    Alexey Smirnov
    May 16, 2010
  4. Cal Who
    Replies:
    4
    Views:
    584
    Cal Who
    May 17, 2010
  5. guywmustang

    How to set margin-left in IE w/Javascript

    guywmustang, Aug 24, 2006, in forum: Javascript
    Replies:
    4
    Views:
    189
    The Magpie
    Aug 26, 2006
Loading...

Share This Page