我在wordpress上有一个简单的html表。我想为每行设置不同的边框颜色,甚至在每行之间都留一些缝隙。我怎样才能做到这一点?
我以这种方式尝试过:
<table style="border-collapse: collapse;">
<tbody>
<tr style="border: 1px solid black;">
<th>Zoo (Country)</th>
<th>Date of Birth</th>
<th>Name</th>
<th>Dam (number of calves)</th>
<th>Sire</th>
</tr>
<tr style="color: darksalmon; border: 1px solid green;">
<td>Knowsley (UK)</td>
<td>2 Jan 2016</td>
<td>Nomvula</td>
<td>Meru (9)</td>
<td>Sharka</td>
</tr>
</tbody>
</table>
在其中您可以看到绿色边框和黑色边框重叠
如果要更改每行的颜色,则需要传递不同的ID,并在每行中指定颜色。
对于很小的差距,您可以给一个班级,或者可以像下面的示例所示进行一些内联样式化
<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
border: 1px solid black;
}
</style>
</head>
<body>
<table>
<tr border-color="#FF0000">
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
</table>
<p>The bgcolor attribute is not supported in HTML5. Use CSS instead.</p>
</body>
</html>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句