In a table heading, the default text alignment for the th
tag is center.
Consider the following code:
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
body {
background-color: aliceblue;
}
.default_grid {
text-align: left;
width: 600px;
color: white;
}
.default_grid th {
/* text-align: left; */
}
.default_grid .first {
background-color: purple;
}
.default_grid .second {
background-color: orange;
}
</style>
</head>
<body>
<table class="default_grid">
<thead>
<tr>
<th class="first">Test One</th>
<th class="second">Test Two</th>
</tr>
</thead>
</table>
</body>
</html>
In Firefox, Internet Explorer 7 (& lower), Safari, Chrome and Opera the text in <th> is aligned left. While in Internet Explorer 8 and Internet Explorer 9, the text is aligned center unless the rule is specified directly on <th> tag (uncomment line# 14).
Which one is the correct behavior?