我有一个简单的HTML表。
<table align="center" border="1" cellpadding="0" cellspacing="0" style="width:1000px">
<thead>
<tr>
<th scope="row">BB<br />
BB<br />
BB</th>
<th scope="col">AA</th>
<th scope="col">AA</th>
<th scope="col">AA</th>
<th scope="col">AA</th>
<th scope="col">AA</th>
<th scope="col">AA</th>
<th scope="col">AA</th>
<th scope="col">AA</th>
<th scope="col">AA</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<p> </p>
但我希望AA细胞在顶部垂直地发光(现在它的中心垂直地发光),并且我希望表上方的空间为0。
用html呈现简单的代码我会理解我的意思。
现在我想链接一个简单的CSS来制作这些功能,但我该如何制作呢?
更新,CSS中的解决方案是:
th{
vertical-align:top;
}
body
{
margin: 0;
padding: 0;
}
试试这个
th{
vertical-align:top;
}
或仅适用于AA
th[scope="col"]{
vertical-align:top;
}
您可以使用以下CSS仅针对包含aa
的单元格:
th[scope="col"] {
vertical-align: top;
}
这是一个jsFiddle演示
试试这个。
<table align="center" border="1" cellpadding="0" cellspacing="0" style="width:1000px">
<thead>
<tr style="vertical-align: top;">
<th scope="row">BB<br />
BB<br />
BB</th>
<th scope="col">AA</th>
<th scope="col">AA</th>
<th scope="col">AA</th>
<th scope="col">AA</th>
<th scope="col">AA</th>
<th scope="col">AA</th>
<th scope="col">AA</th>
<th scope="col">AA</th>
<th scope="col">AA</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<p> </p>