Overwrite Table cellspacing using CSS

Discussion in 'CSS' started by kuljitsingh, Aug 6, 2007.

  1. #1
    hi
    I am working on a potal in which pages are generated from .NET code behind. Code adds a table and its attributes. Code change means setting up a dev environment, and re-compiling the whole portal code. (not the desirable soln by manager)

    This is how the html looks on view source source. The second table is the one I m interested to fix. It has cellspacing of 10 which i wish to change it with CSS to 0.

    I tried -
    table { margin:0; padding:0; }
    But it did not work. Any help will be appreciated. We use IE and FF.


    <body.....
    <table...
    </table>
    <table cellspacing="10"...
    </table>
    ......
    </body>
     
    kuljitsingh, Aug 6, 2007 IP
  2. krt

    krt Well-Known Member

    Messages:
    829
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    120
    #2
    table { border-collapse: collapse; }
     
    krt, Aug 6, 2007 IP
  3. kuljitsingh

    kuljitsingh Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    kewl that worked.. thanks.
    But at the same time, it changed spacing of all the tables.

    Is there way to pick just the second table and apply the change.

    like body.table.table something like that
     
    kuljitsingh, Aug 6, 2007 IP
  4. euler

    euler Peon

    Messages:
    30
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    <body.....
    <table...
    </table>
    <table class="class1" cellspacing="10"...
    </table>......
    </body>

    table.class1 { border-collapse: collapse; }
     
    euler, Aug 6, 2007 IP
  5. kuljitsingh

    kuljitsingh Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    There is no class assigned to the table in code-behind. Thats why i am handicapped and trying differetn alternatives. like -
    body > table {}

    The issue is browser compatibility. The above just works in FF but not in IE.
     
    kuljitsingh, Aug 6, 2007 IP