PDA

View Full Version : Table border help



snake
07 Dec 2007, 07:24 PM
Is there a way to have a border for the perimeter of the table , but not for the inside lines? Or, just not the horizontal lines?

Wickham
08 Dec 2007, 03:13 AM
You need to use CSS, putting the styles in a separate stylesheet or inside <style>..</style> tags in the head section:-

Put this in the head section of your html page:-
<style type="text/css">
table { border: 1px solid black; }
</style>

OR

edit your table body markup in the html file:-
<table style="border: 1px solid black;">
<tr>
<td>......
</td></tr></table>

OR

Put this in a separate stylesheet:-
table { border: 1px solid black; }

and don't put any border size in the table body markup like border="1" which would put a border around the table and cells.

You can vary this by having just horizontal borders, left borders or whatever you want for the cells.

If you add
td { border-left: 1px solid red; border-right: 1px solid red; } to the style in a stylesheet or head section style tags then all cells will have just vertical borders.

By giving one td cell a class you can have borders just for that cell only.

See
http://www.wickham43.supanet.com/tutorial/generaladvice.html