SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    Get my greedy down dotJoon's Avatar
    Join Date
    Apr 2003
    Location
    daejeon, South Korea
    Posts
    2,211
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    removing space between table <tr>

    Code:
    <!DOCTYPE html>
    <html>
    <meta charset="UTF-8">
    <style type="text/css">
    
    * { margin:0;padding:0}
    .white {color:#fff}
    .bBlack {background-color:#000}
    </style>
    <body>
    <table>
      <tr>
        <td colspan="3" class="white bBlack">topLine</td>
      </tr>
      <tr>
        <td class="white bBlack">leftLine</td>
        <td>myText</td>
      </tr>
    </table>
    </body>
    </html>
    The code above shows a white space between topLine and leftLine which are black backgrounded.

    I like to remove the white space between them so that the topLine and the leftLine are connected with black background without any white space.

    The code below shows my target result. But I like to put cellspacing="0" between <style> and </style>.

    if possible, I like to make to remove all spaces between table <tr> in all tables in my page
    the code * { margin:0;padding:0} seems not sufficient for it.


    Code:
    <table cellspacing="0">
      <tr>
        <td colspan="3" class="white bBlack">topLine</td>
      </tr>
      <tr>
        <td class="white bBlack">leftLine</td>
        <td>myText</td>
      </tr>
    </table>

  2. #2
    Mouse catcher silver trophy
    Stevie D's Avatar
    Join Date
    Mar 2006
    Location
    Yorkshire, UK
    Posts
    5,836
    Mentioned
    114 Post(s)
    Tagged
    1 Thread(s)
    The CSS you need to achieve cellspacing="0" is
    Code:
    table {border-collapse: collapse;}


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •