How do I get a square around a table?

liunx

Guest
Can someone tell me how I can get a square around a table?<br />
I just can't figure it out!<br />
<br />
I saw this simple website: <!-- m --><a class="postlink" href="http://www.physiotherapy-specialists.co.uk/">http://www.physiotherapy-specialists.co.uk/</a><!-- m --><br />
<br />
I had a look at the code... and I'm still lost.<br />
They seem to use a tiny gif...<br />
But... I can't figure out how they get the lines?<br />
<br />
Any help would be aprpeciated.<br />
<br />
Thanks.<br />
<br />
<br />
Jam<!--content-->Easily done with CSS:<br />
<br />
<table style="border: 1px solid black;"><br />
<tr><br />
<td>Row One, Cell One</td><br />
<td>Row One, Cell Two</td><br />
</tr><br />
<tr><br />
<td>Row Two, Cell One</td><br />
<td>Row Two, Cell Two</td><br />
</tr><br />
</table><!--content-->They used a nested table - the outer table has a black (#000000) background, and it has a padding of 1 px. The tiny gif you are thinking of (media/images/pix.gif) is actually a 1x1 px spacer (not relevant to what you are looking for) <br />
<br />
Here is a stripped code for tables, so you can see better how they achieved it.<br />
<table width="750" bgcolor="#000000" border="0" cellpadding="1" cellspacing="0"><br />
<tr> <br />
<td> <br />
<table width="748" bgcolor="#ffffff" border="0" cellpadding="0" cellspacing="0"><br />
<tr> <br />
<td></td><br />
</tr><br />
</table> <br />
<br />
---------------------------<br />
CSS is a much better choice, though, just as pyro suggested.<!--content-->Thanks for the replies.<br />
I think I'll use CSS.<br />
<br />
But...<br />
I was sure u had made a mistake in your coding...<br />
But it seems not.<br />
<br />
What is a nested table?<br />
(Em.. I've never come accross it.) :)<!--content-->A nested table is a table inside of a table. Generally a bad idea.<br />
<br />
<table><br />
<tr><br />
<td><br />
<table><br />
<tr><br />
<td>blah</td><br />
</tr><br />
</table><br />
</td><br />
</tr><br />
</table><!--content-->I still don't get it.<br />
<br />
Look at Daria's code.<br />
Is it right?<br />
Surely there has to be an errorin there?<br />
<br />
Using nested tables, I can't get a line width to be as fine as what I get from Daria's example.<br />
<br />
I'm confused.<br />
<br />
:(<!--content-->And why are nested tables frowned on?<br />
I use them all the time.<br />
(Though I didn't know I was using nested tables.) :)<!--content-->Because you should be using CSS to format your pages... Also, yes, the code that Daria posted [I assume from the site you posted] will work (once you close the open tags) but it is the "suicide" way of doing it... ;)<!--content-->it'll work fine, but all those blind people on palm pilots won't be able to see it (oh and it's just a bad idea to have tables nested 4 deep)<!--content-->Reasons why nested tables are bad:<br />
1. Usually not search engine friendly<br />
2. Totally ignore other browsers (palm pilot, screen readers etc)<br />
3. Bloated content (CSS-based layout can save 35 to 50% on bandwidth)<br />
4. Difficult to maintain due to the complexity posed by nesting the tables.<br />
<br />
In this example, why would you nest tables when<br />
table {border: 1px solid #000}<br />
accomplishes the same task much more easily?<!--content-->Yes, nested tables within XHTML Basic 1.0 are illegal by default for a good reason. Furthermore they don't work too well when linearized.<!--content-->
 
Back
Top