是否有可用的HTML属性等同于CSS属性border-collapse: collapse;
?
我试图仅使用HTML实现相同的1px边框,而不是使用css。
table{
border-collapse: collapse;
}
<table border="1px" cellpadding="3">
<tr>
<td>Row 1</td>
<td>Row 1</td>
<td>Row 1</td>
</tr>
<tr>
<td>Row 2</td>
<td>Row 2</td>
<td>Row 2</td>
</tr>
</table>
答案 0 :(得分:2)
您可以尝试cellspacing
。
<table border="1px" cellspacing="0" cellpadding="3">
<tr>
<td>Row 1</td>
<td>Row 1</td>
<td>Row 1</td>
</tr>
<tr>
<td>Row 2</td>
<td>Row 2</td>
<td>Row 2</td>
</tr>
</table>
注意: cellspacing 不会重叠相邻单元格的边框,而CSS属性也是如此。
答案 1 :(得分:0)
您可以使用cellspacing或cellpadding但HTML5中已弃用
答案 2 :(得分:0)
我不明白你为什么要停止使用CSS,因为这就是css所做的 你可以使用boostrap css包含在里面。 欲了解更多信息,请访问w3chools
<div class="container">
<h2>Basic Table</h2>
<p>The .table class adds basic styling (light padding and only horizontal dividers) to a table:</p>
<table class="table">
<thead>
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Email</th>
</tr>
</thead>
<tbody>
<tr>
<td>John</td>
<td>Doe</td>
<td>john@example.com</td>
</tr>
<tr>
<td>Mary</td>
<td>Moe</td>
<td>mary@example.com</td>
</tr>
<tr>
<td>July</td>
<td>Dooley</td>
<td>july@example.com</td>
</tr>
</tbody>
</table>
</div>