Entry
How to set the margins for tables, i.e i want the texts to be away from the table borders.
Oct 18th, 2001 10:50
Eddie Shipman, pushpa vathi, Use a DIV inside the cell and use CSS margins
I use CSS Borders on my tables and needed to keep the borders touching
and cellspacing and cellpadding made it look bad so I came up with this:
The first Cell has a 4px margin around the cell contents. I tried using
the same style on just the cell and it didn't work, as shown in the
second cell.
<html>
<head>
<title>Table Cell Margins</title>
</head>
<body>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td style="border-top: solid 2px black; border-left: solid
2px black; border-right: solid 2px black; border-bottom: solid 2px
black;">
<div style="margin: 4px 4px 4px 4px;">
At FAQTs our focus is on quality, not quantity. There are
hundreds of search engines and mailing lists providing snippets of
information and half answers for your questions. FAQTs contains clear
questions with complete answers so you don't need to search anywhere
else.
</div>
</td>
<td style="margin: 4px 4px 4px 4px; border-top: solid 2px black;
border-right: solid 2px black; border-bottom: solid 2px black;">
At FAQTs our focus is on quality, not quantity. There are
hundreds of search engines and mailing lists providing snippets of
information and half answers for your questions. FAQTs contains clear
questions with complete answers so you don't need to search anywhere
else.
</td>
</tr>
</table>
</body>
</html>