OK, I have a table on my site (for tabular data, of course), and I need to want to format it with CSS. How would I go about formatting it and get the same affect is if I had used:
<table border="1">
I can't just put a border on the table with CSS, because that would only make it go around the outside. How do I do this? Thanx,
-DanHow's this:table, td{
border-top:1px solid #eee;
border-left:1px solid #eee;
border-bottom:1px solid #ccc;
border-right:1px solid #ccc;
}No, I should've made myself clearer, sorry What I want to do is have a 1px border throughout the whole thing, but I can't figure out how to do this, because as soon as I put 2 td's together, it will turn into a 2px border.
-DanI'm not sure what you're getting at, you got a quick mock up in paint that I could look at?I just want to have the border equal width throughout the table, like it is if you use <table border="0">, only I want to do it with CSS. I can't just put a CSS border on the table, because then it will only go around the outside, and not around every cell. Also, I want the border to be 1px thick, so if I were to put a 1px border on every td, it would look like a 2px border where the td's touch eachother. I hope this is understandable, a mock-up wouldn't help explain it any better.
-DanI think I have worked out what you want, although I still think that a mock up would have helped tremendously.couldn't the effect be achieved by using a 1px border on all td's, then using border:collapse to remove the gap between cells and rows?Moondance is correct; this will achieve what you want
<style type="text/css">
/*<![CDATA[*/
table, td {
border: 1px solid #000;
border-collapse: collapse;
}
/*]]>*/
</style>
... ... ...
<table>
<thead><tr><th>Column 1</th><th>Column 2</th><th>Column 3</th></tr></thead>
<tbody><tr><td>Row 1, Cell 1</td><td>Row 1, Cell 2</td><td>Row 1, Cell 3</td></tr>
<tr><td>Row 2, Cell 1</td><td>Row 2, Cell 2</td><td>Row 2, Cell 3</td></tr>
<tr><td>Row 3, Cell 1</td><td>Row 3, Cell 2</td><td>Row 3, Cell 3</td></tr></tbody>
</table>Thanks Paul!Heheh, you should probably thank moondance; I just provided a visual of what he/she said.
<table border="1">
I can't just put a border on the table with CSS, because that would only make it go around the outside. How do I do this? Thanx,
-DanHow's this:table, td{
border-top:1px solid #eee;
border-left:1px solid #eee;
border-bottom:1px solid #ccc;
border-right:1px solid #ccc;
}No, I should've made myself clearer, sorry What I want to do is have a 1px border throughout the whole thing, but I can't figure out how to do this, because as soon as I put 2 td's together, it will turn into a 2px border.
-DanI'm not sure what you're getting at, you got a quick mock up in paint that I could look at?I just want to have the border equal width throughout the table, like it is if you use <table border="0">, only I want to do it with CSS. I can't just put a CSS border on the table, because then it will only go around the outside, and not around every cell. Also, I want the border to be 1px thick, so if I were to put a 1px border on every td, it would look like a 2px border where the td's touch eachother. I hope this is understandable, a mock-up wouldn't help explain it any better.
-DanI think I have worked out what you want, although I still think that a mock up would have helped tremendously.couldn't the effect be achieved by using a 1px border on all td's, then using border:collapse to remove the gap between cells and rows?Moondance is correct; this will achieve what you want
<style type="text/css">
/*<![CDATA[*/
table, td {
border: 1px solid #000;
border-collapse: collapse;
}
/*]]>*/
</style>
... ... ...
<table>
<thead><tr><th>Column 1</th><th>Column 2</th><th>Column 3</th></tr></thead>
<tbody><tr><td>Row 1, Cell 1</td><td>Row 1, Cell 2</td><td>Row 1, Cell 3</td></tr>
<tr><td>Row 2, Cell 1</td><td>Row 2, Cell 2</td><td>Row 2, Cell 3</td></tr>
<tr><td>Row 3, Cell 1</td><td>Row 3, Cell 2</td><td>Row 3, Cell 3</td></tr></tbody>
</table>Thanks Paul!Heheh, you should probably thank moondance; I just provided a visual of what he/she said.