【发布时间】:2022-12-16 13:02:29
【问题描述】:
您好,我正在编写一些 html 代码,其中我也必须制作表格以进行对比。在一个表格中,我将 border-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>
感谢您花时间阅读我的问题
【问题讨论】:
-
抱歉贴错了第二个表格样式的代码是:<table style="border-width:1px;border-style:solid;border-color:blue;border-collapse:collapse">