【发布时间】:2019-11-02 20:45:53
【问题描述】:
我想在 $100 上应用 CSS,它是 table 内的 div 元素。它应该是红色的,但我的 CSS 选择器不起作用。
<!DOCTYPE html>
<html>
<head>
<style>
table {
display: table;
border-collapse: separate;
border-spacing: 2px;
border-color: gray;
}
.new > div{
color:red;
}
</style>
</head>
<body>
<table class="new">
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>
<div>$100</div>
</td>
</tr>
<tr>
<td>February</td>
<td>$80</td>
</tr>
</table>
</body>
</html>
【问题讨论】: