Let's say I wanted to create a single-rowed table with 50 pixels in between each column, but 10 pixels padding on top and the bottom.
How would I do this in HTML/CSS?
Let's say I wanted to create a single-rowed table with 50 pixels in between each column, but 10 pixels padding on top and the bottom.
How would I do this in HTML/CSS?
If you need to give a distance between two rows use this tag
You can just use padding. Like so:
http://jsfiddle.net/davidja/KG8Kv/
HTML
CSS
OR
Set the width of the
<td>
s to50px
and then add your<td>
+ another fake<td>
Fiddle.
Code Explained:
The first CSS rule checks for empty td's and give them a width of 50px then the second rule give the padding of top and bottom to all the td's.
Try
A better solution than selected answer would be to use border-size rather than border-spacing. The main problem with using border-spacing is that even the first column would have a spacing in the front.
For example,
To avoid this use:
border-left: 100px solid #FFF;
and setborder:0px
for the first column.For example,
There isn't any need for fake
<td>
s. Make use ofborder-spacing
instead. Apply it like this:HTML:
CSS:
See it in action.