我有一个html表格,列宽是固定的。我有一列需要旋转270度的内容。内容的长度是动态的,可以变化。我有下面的代码,但问题在于它旋转时,首先表格单元格的宽度扩大,高度变小,结果内容会向上并消失。并且它也不对齐到单元格的底部。CSS旋转表格单元格和高度调整内容
我想单元格的宽度保持固定,我已经定义了,但高度需要自动调整。这里是一个的jsfiddle:https://jsfiddle.net/d7c4q924/1/
这里是我的代码有目前:
<style type="text/css">
.container{
width:100%;
display: inline-block;
white-space: nowrap;
transform: rotate(270deg);
transform-origin: left top 0;
}
</style>
<table border="1" width="600px">
<tr>
<td width="100px">column1</td>
<td width="100px"><span class="container">this column has a dynamic length string</span></td>
<td width="100px">column3</td>
<td width="300px">column4</td>
</tr>
</table>
可能的重复http://stackoverflow.com/questions/6997631/how-to-display-vertical-text-in-table-headers-with-auto-height-without-text -ov – helb