Log in

View Full Version : a border outside the table but none inside



amyy
02-12-2008, 01:49 PM
<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

boogyman
02-12-2008, 04:50 PM
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"

jscheuer1
02-12-2008, 05:01 PM
<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>

html tablesrule
02-15-2008, 04:53 AM
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.

jscheuer1
02-15-2008, 06:16 AM
Nesting tables is always a bad idea if it can possibly be avoided.