I want to apply CSS on $100 that is a div
element inside a table
. It should be red in color, but my CSS selector does not work.
<!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>