Jump to content

Table and TD borders (how do I stop double lines?)


Mutley

Recommended Posts

If I do:

table {
border:1px #000000 solid;
}

It puts a border around the edge, now if I do this aswell:

td {
border:1px #000000 solid;
}

It puts a border around the cells but where the cells and edge of the table meet, you get a double thick border, how do I stop this?
Link to comment
Share on other sites

[quote author=ToonMariner link=topic=110213.msg445854#msg445854 date=1159869667]
remove the border on the table - just have borders on the td's
[/quote]
That will still cause the parts where they meet to be double thickness.

[s]I find when making table borders, I setup classes which I give to different parts of the table.[/s] Eg:
[code]<html>
<head>
  <title>example</title>
  <style type="text/css">
    table {
        border-right: 1px solid #000;
        border-bottom: 1px solid #000;
    }

    td {
      border-top: 1px solid #000;
      border-left: 1px solid #000;
    }
  </style>
</head>

<body>

<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td>Item (1, 1)</td>
    <td>Item (1, 2)</td>
    <td>Item (1, 3)</td>
  </tr>
  <tr>
    <td>Item (2, 1)</td>
    <td>Item (2, 2)</td>
    <td>Item (2, 3)</td>
  </tr>
  <tr>
    <td>Item (3, 1)</td>
    <td>Item (3, 2)</td>
    <td>Item (3, 3)</td>
  </tr>
</table>

</body>
</html>[/code]

[EDIT] Update - Removed classes and moved the border-right/bottom to the table, now it's even easier. :)
Link to comment
Share on other sites

[quote author=ToonMariner link=topic=110213.msg445864#msg445864 date=1159871330]
If you can cope with it give each cell a margin of 1px - it will leave a small gap between cells and IMO looks quite nice while removeing the 'complexity' of defining classes for various parts of the table. But I am very lazy! ;)
[/quote]
Just updated my code, now it doesn't use any classes. :D
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.