嗨,我正在写一些html代码,其中我有太多的表来对比。在一个表格中,我将border-collapse属性设置为独立的,在另一个表格中,我将它设置为collapse属性。问题是在另一个表中,因为我覆盖它以折叠边框,由于某种原因,我无法使用color属性更改边框颜色。下面是一些代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Living vs Non living</title>
<style type="text/css">
body{background-color:RGB(255,251,214)}
table,th,td{border:1px solid red}
table{border-collapse:separate;border-spacing:20px}
</style>
</head>
<body>
<table>
<caption><h3>Livings things and non-living things</h3></caption>
<tr>
<th style = background-color:red;color:white>Living things</th>
<th style = background-color:red;color:white>Non Living things</th>
</tr>
<tr>
<td>Consists of cell</td>
<td>No cell</td>
</tr>
<tr>
<td>Needs food for energy</td>
<td>Needs no food</td>
</tr>
<tr>
<td>Shows growth and movement</td>
<td>No growth and movement</td>
</tr>
</table>
<table style="border-width:1px;border-style:solid;border-color:blue;color:white">
<caption><h3>Livings things and non-living things</h3></caption>
<tr>
<th style = background-color:cyan>Living things</th>
<th style = background-color:cyan>Non Living things</th>
</tr>
<tr>
<td>Consists of cell</td>
<td>No cell</td>
</tr>
<tr>
<td>Needs food for energy</td>
<td>Needs no food</td>
</tr>
<tr>
<td>Shows growth and movement</td>
<td>No growth and movement</td>
</tr>
</table>
</body>
</html>
感谢您花时间阅读我的问题
结果证明它是有效的,我所需要做的就是分别编辑td和th,以及上面在标题中所做的。我认为这样做是为了让编辑表格中的每个元素更容易