[英]CSS: How to set border for a specific table on the page including columns and rows
I have page that has 3 tables. 我的页面有3个表格。
The table that I need has an id "tblContent" 我需要的表的ID为“ tblContent”
I set the border for the table: 我为表格设置边框:
#tblContent
{
width:100%;
border:1px solid black;
border-collapse:collapse;
}
But this only sets border around the table. 但这只会在桌子周围设置边框。
How can I modify CSS to have the border for rows and columns as well? 如何修改CSS以使行和列也具有边框?
Add a border to the table cells as well. 也为表格单元格添加边框。
#tblContent td, #tblContent th {
border:1px solid black;
}
#tblContent { width: 100%; border: 1px solid black; border-collapse: collapse; } #tblContent td, #tblContent th { border: 1px solid black; }
<table id="tblContent" style="width: 100%"> <tr> <th> </th> <th> </th> <th> </th> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> </table>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.