how do I display the gridlines in a HTML table? (am using IE6)
Asked
Active
Viewed 1.6e+01k times
56
-
What do you mean by gridlines? – Ikke Nov 19 '09 at 12:42
3 Answers
109
Via css. Put this inside the <head>
tag.
<style type="text/css" media="screen">
table{
border-collapse:collapse;
border:1px solid #FF0000;
}
table td{
border:1px solid #FF0000;
}
</style>

pixeline
- 17,669
- 12
- 84
- 109
-
3
-
1the border-collapse on tds is superfluous (and in fact not standard). – Boldewyn Nov 19 '09 at 12:44
-
one more question - how do I make the vertical lines solid, and the horizontal lines dashed? – Allan Bowe Nov 19 '09 at 13:55
-
3border-left: 1px solid black; border-right:1px solid black; border-bottom:1px dotted black ( or dashed) – pixeline Nov 19 '09 at 14:40
-
24
<table border="1"></table>
should do the trick.

slugster
- 49,403
- 14
- 95
- 145
-
2Should work, but it's better to separate content and design (content in html, design in css, where border is design. – MysticEarth Nov 19 '09 at 12:45
-
14
-
1This is great for troubleshooting when using colspan a lot. Being able to add or remove border='1' is much simpler than messing with css. – Colin Keenan May 09 '18 at 04:56
0
For internal gridlines, use the tag: td For external gridlines, use the tag: table