table标签属性
table标签
border
border标签属性:设定围绕表格的边框的宽度:
table1 | 1 | 1 |
1 | 1 | 1 |
1 | 1 | 1 |
border标签属性不仅设置围绕表格边框的宽度,还为每个单元格添加宽度为1px的边框
实际开发中不建议使用border标签属性实现边框效果,建议通过为table、th和td设定border样式属性实现,如下代码
tabletable{
border: 1px solid black;
}
td{
border: 1px solid black;
}
1 | 1 | 1 |
1 | 1 | 1 |
1 | 1 | 1 |
width
由于这里表格过于紧凑,所以可以设置table的宽度,在样式属性中添加width设置为50%
table{
width: 50%;