border-collapse的用法和具体意义,最终效果是什么
参考一下:https://developer.mozilla.org/zh-CN/docs/Web/CSS/border-collapse
如果对你有帮助,可以点击我这个回答右上方的【采纳】按钮,给我个采纳吗,谢谢
对表格设置,主要做细线表格的,你设置边框后,加这个属性就可以做细线
table, td { border:1px solid #000;border-collapse:collapse ;}
border-collapse 是要设置在table元素上的
table
{
border-collapse:collapse;
}
设置tr元素不行
具体你可以看看,https://www.w3school.com.cn/cssref/pr_border-collapse.asp
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<style type="text/css">
table
{
border-collapse:collapse;
}
table, td, th
{
border:1px solid black;
}
</style>
</head>
<body>
<table>
<tr>
<th>Firstname</th>
<th>Lastname</th>
</tr>
<tr>
<td>Bill</td>
<td>Gates</td>
</tr>
<tr>
<td>Steven</td>
<td>Jobs</td>
</tr>
</table>
<p><b>注释:</b>如果没有规定 !DOCTYPE,border-collapse 属性可能会引起意想不到的错误。</p>
</body>
</html>