why does row 2 “Test 2” get overridden with orange?
<head runat="server">
<title></title>
<style type="text/css">
td
{
color: white;
}
.testclass td
{
background-color: Orange;
}
</style>
<link href="StyleSheet.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<div>
<table>
<tr class="testclass">
<td style="background-color: Blue">
Test 1
</td>
</tr>
<tr class="testclass">
<td bgcolor="fushcia">
Test 2
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
bgcoloris a presentational HTML attribute. It will always be overridden by any actual CSS style declarations.This is mentioned in the spec:
In plain English, this means presentational attributes have almost no meaning, and are even more brittle than styles in a
*rule in an author stylesheet (which also has zero specificity).