0
我試圖修復包含旋轉文本的單元格的寬度。除了前3列以外,其餘部分只需稍微超過垂直文本字體的高度。剩下的空間可以在前三列之間平分。設置<th>當單元格包含旋轉(垂直)文本時在css中的單元格寬度
我試過設置在CSS的單元格的寬度,但它沒有什麼區別...
這裏有一個例子http://jsfiddle.net/pelagic/3Ggw6/1/
HTML
<div id="galley">
<table>
<thead><tr>
<th colspan="3" class="vertical-label"> </th>
<th colspan="11"><div>Regions</div></th>
<th width="5%" class="vertical-label"> </th>
</tr>
<tr>
<th width="5%" class="vertical-label"><div class="vheader">
<div align="left">One</div>
</div></th>
<th width="5%" class="vertical-label"><div class="vheader">
<div align="left">One</div>
</div></th>
<th width="5%" class="vertical-label"><div class="vheader">
<div align="left">One</div>
</div></th>
<th width="10" class="vertical-label"><div class="vheader">
<div align="left">Antarctic</div>
</div></th>
<th width="5%" class="vertical-label"><div class="vheader">
<div align="left">Arctic</div>
</div></th>
<th width="5%" class="vertical-label"><div class="vheader">
<div align="left">Baltic Sea</div>
</div></th>
<th width="5%" class="vertical-label"><div class="vheader">
<div align="left">Black Sea</div>
</div></th>
<th width="5%" class="vertical-label"><div class="vheader">
<div align="left">Cas•pian Sea</div>
</div></th>
<th width="5%" class="vertical-label"><div class="vheader">
<div align="left">Indo Pacific</div>
</div></th>
<th width="30" class="vertical-label"><div class="vheader">
<div align="left">Mediterranean Sea</div>
</div></th>
<th width="5%" height="150" class="vertical-label"><div class="vheader">
<div align="left">North Atlantic</div>
</div></th>
<th width="5%" height="150" class="vertical-label"><div class="vheader">
<div align="left">North Pacific</div>
</div></th>
<th width="5%" height="150" class="vertical-label"><div class="vheader">
<div align="left">South Atlantic</div>
</div></th>
<th width="auto" height="150" class="vertical-label"><div class="vheader">
<div align="left">South Pacific</div>
</div></th>
<th width="5%" class="vertical-label"><div class="vheader">
<div align="left">References</div>
</div></th>
</tr>
</thead>
<tfoot></tfoot>
<tbody><tr><td>Otariidae</td>
<td>Arctocephalus pusillus</td>
<td>Cape or Australian fur seal</td>
<td> </td>
<td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
<tr class="alt"><td> </td><td>Arctophoca gazella</td>
<td>Antarctic fur seal</td>
<td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
<tr><td> </td><td>A. tropicalis</td>
<td>Subantarctic fur seal</td>
<td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
</tbody>
</table>
</div>
CSS
#galley {
width: 738px;
height: auto;
border: 1px #CCCCCC;
float:none
}
#galley table, th, td {
border: 1px solid black;
border-collapse:collapse;
}
#galley table {
table-layout: fixed;
width: 738px;
}
#galley th.vertical-label{
-webkit-transform: rotate(270deg) translateX(100%) translateY(33%);
-moz-transform: rotate(270deg) translateX(100%) translateY(33%);
-o-transform: rotate(270deg) translateX(100%) translateY(33%);
-webkit-transform-origin: 100% 100%;
-moz-transform-origin: 100% 100%;
-o-transform-origin: 100% 100%;
writing-mode: lr-tb;
}
#galley th, th.vertical-label{
font-family: "myriad Pro";
font-decoration: bold;
}
#galley .vheader{
margin-left: 5px;
}