1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

What is equivalent for cellpadding="0" cellspacing="0" in CSS

Discussion in 'CSS' started by sponge.nika, Dec 19, 2011.

  1. #1
    I need to find equivalent for cellpadding="0" cellspacing="0" in CSS so it will work in all browsers.
    I tried

    HTML

    <table class="tbl" border="0">
    <tr>
    <td><img src="images/logov1.gif" alt="" width="341" height="20"></td>
    <td></td>
    </tr>
    <tr>
    <td><img src="images/logov2.gif" alt="" width="341" height="100"></td>
    <td></td>
    </tr>
    </table>
    HTML:

    CSS

    .tbl{border-collapse: collapse; border-spacing: 0px; width: 100%; padding:0px; }
    Code (markup):

    even I tried

    
    table {
    border-collapse : collapse;
    }
    
    table td, table th {
    padding : 0;
    }
    
    Code (markup):
    It works only in Internet Explorer,
    In Firefox and Chrome there is a space between images.
     
    sponge.nika, Dec 19, 2011 IP
  2. Toycel

    Toycel Peon

    Messages:
    243
    Likes Received:
    11
    Best Answers:
    4
    Trophy Points:
    0
    #2
    Do you have a master reset in the CSS as Firefox and Chrome add the padding initially in the browser settings.
     
    Toycel, Dec 19, 2011 IP
  3. Phil Comforthost

    Phil Comforthost Peon

    Messages:
    30
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Have you thought about not using a table in the first place?

    That's the beauty (among others) of CSS, that you can just position anything exactly where you want it.
     
    Phil Comforthost, Dec 19, 2011 IP
  4. JamesD31

    JamesD31 Peon

    Messages:
    36
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    0
    #4
    You almost will never get a fully universal look / feel across all browsers (even between FF and Chrome).

    Also note that you are putting padding 0 for the COLUMN "td". If you are looking to have the two images on top of each other, try making the margin / padding for "table tr" 0 as well? just a thought :)

    ALSO remove the second <td></td> that could be causing a spacing as well.
     
    JamesD31, Jan 7, 2012 IP
  5. arwen54

    arwen54 Active Member

    Messages:
    632
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    60
    #5
    James is right, unless you want to include IE hacks. Removing the extra <td></td> in each row will probably help.
     
    arwen54, Jan 7, 2012 IP
  6. tronik

    tronik Peon

    Messages:
    48
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    try this:
    
    
    table td, table th {margin: 0;padding : 0;}
    Code (markup):
     
    tronik, Jan 20, 2012 IP