Web Hosting Talk







View Full Version : Cell inside my table


hopesfall
10-21-2008, 07:37 PM
Cell inside my table

I am trying to get a cell inside a table just big enough so that all that is surrounding it is the 15px cellpadding. Is this markup wrong? Because it doesn't work... what am I doing wrong
Code:
<table border="1" cellpadding="10" cellspacing="0" width="800" class="midTable" style="margin: 45 0 0 0;">
<tr>
<td width="100%" valign="top" border="1" style="padding: 15px;">
</td>
</tr>
</table>

ipv6guru
10-21-2008, 08:18 PM
Note that padding pads the inside of the cell - so that whatever content inside the cell is padded by 15px (in this case).
Changing to cellspacing="15" will do what you want.
Note that your style="margin:45 0 0 0;" probably wont work either unless you specify "margin:45px 0px 0px 0px;"





__________________
Gav...http://www.16degrees.com.auCustom Hosting :: Custom Web Design :: Developer Tools :: Application Software Hosting

ipv6guru
10-21-2008, 08:26 PM
Also I dont see much point in giving the table a class name if your still going to declare the styles inline. The idea of the class is so that you can control its behavior from a stylesheet.
In the case above ,pseudo:-
.midTable table{
border:1px;
cellspacing:15px;
width:800px;
margin:45px 0px 0px 0px;}
and put that in a separate style sheet or use a style block in the <head> section if neccessary. Then you can strip out all those styles from the code itself.





__________________
Gav...http://www.16degrees.com.auCustom Hosting :: Custom Web Design :: Developer Tools :: Application Software Hosting