I need to change the background color of cells with freezing temperature (32F, 0C) to #bff9ff but have some difficulties. I tried to print CSS class inside <td>
but seems it just doesn't work properly inside the loop and being printed at the same time.
However, it's half a problem. How can I identify those cells with freezing temp and below not manually but using PHP?
<html>
<head>
<meta charset="UTF-8">
<title>Unit 3 part 2</title>
<style>
table {
font-family: arial, sans-serif;
border-collapse: collapse;
width: 100%;
}
tr:hover {
background-color:#bff9ff;
}
td, th {
border: 1px solid #dddddd;
text-align: left;
padding: 8px;``
}
.cell {
background-color: #00bfff;
}
</style>
</head>
<body>
<table border="1" cellpadding="3">
<thead>
<th>Fahrenheit</th>
<th>Celsius</th>
</thead>
<?php
$fahrenheit = 50;
while ($fahrenheit >= -50) {
$celsius = ($fahrenheit - 32) * 5 / 9;
print "<tr><td>$fahrenheit</td><td>$celsius</td></tr>";
$fahrenheit -= 5;
$celsius -= 5;
} ?>
</table>
</body>
</html>