Reputation: 2305
Please forgive my all-encompassing ignorance, but I just can't get my table to look right in my webform.
I declare a table:
<table>
</table>
and it has no border. There is an attribute for border, as such:
<table border="1">
</table>
but asp.net tells me that the border attribute is 'obsolete'. I try to add it in CSS...
.table{ border: 1px solid black; border-collapse: collapse; }
...but this just puts a border around the whole table, not the individual cells.
All I want is a normal looking table with lines around each cell. What is the proper way to do this?
Upvotes: 0
Views: 91
Reputation: 16675
Use this:
table, table th, table td { border: 1px solid black; border-collapse: collapse; }
(need to apply the border to the table-cells too)
Upvotes: 6
Reputation:
The code above won't work as...
.table{ border: 1px solid black; border-collapse: collapse; }
is looking for a class of "table" and not a table element. Either update the table class to "table"...
<table class="table">
...or change your CSS to find the table element itself.
table{ border: 1px solid black; border-collapse: collapse; }
You will also need to style th
and td
elements to have the border.
Upvotes: 1