Results 1 to 5 of 5

Thread: a border outside the table but none inside

  1. #1
    Join Date
    Aug 2007
    Posts
    45
    Thanks
    27
    Thanked 0 Times in 0 Posts

    Default a border outside the table but none inside

    HTML Code:
    <table BORDER="0" cellspacing="5" cellpadding="5">
    <tr bgcolor=blue><td colspan=3>abc</td></tr>
    <tr><td>def</td><td>ghi</td><td>jkl</td></tr>
    <tr><td>def</td><td>ghi</td><td>jkl</td></tr></table>
    May I know how to modify the above code so that I could have a border outside the table -ie a rectangular outline(and no border/line inside the table) ?
    Thank you

  2. #2
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    put a border on the table and not on the td cells?
    or put a border on the table then assign some padding so it appears to be "outside"

  3. #3
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    HTML Code:
    <table style="border:2px solid red;" cellspacing="5" cellpadding="5">
    <tr style="background-color:blue;"><td colspan=3>abc</td></tr>
    <tr><td>def</td><td>ghi</td><td>jkl</td></tr>
    <tr><td>def</td><td>ghi</td><td>jkl</td></tr></table>
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  4. #4
    Join Date
    Feb 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile

    I'm new to this stuff, but my first idea is to put it all into another table and define the new table border, but not the new column <td>.

    I tried it and it looks cool.

    <body>


    <table cellpadding="0" cellspacing="0" border ="5">


    <tr><td>

    <table BORDER="0" cellspacing="5" cellpadding="5">
    <tr bgcolor=blue><td colspan=3>abc</td></tr>
    <tr><td>def</td><td>ghi</td><td>jkl</td></tr>
    <tr><td>def</td><td>ghi</td><td>jkl</td></tr></table>

    </td></tr></table>

    </body>
    </html>


    simply change the color or size of the first table to surround the inside table the way you'd like.
    IF YOU DON'T ASSIGN ANY WIDTH OR HEIGHT VARIABLE IT WILL DEFAULT TO THE SIZE OF THE INSIDE TABLE AND IT'S CONTENTS.

    good luck.

  5. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Nesting tables is always a bad idea if it can possibly be avoided.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

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
  •