在表标题中,th标记的默认文本对齐方式是居中.
请考虑以下代码:
<!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>
Run Code Online (Sandbox Code Playgroud)
在Firefox,Internet Explorer 7(及更低版本),Safari,Chrome和Opera中,<th>中的文本左对齐.在Internet Explorer 8和Internet Explorer 9中,除非直接在<th>标记上指定规则(取消注释第14行),否则文本将对齐居中.
哪一个是正确的行为?