你可以使用这个神奇的片段来完全控制所有内容:
http://zerosixthree.se/vertical-align-anything-with-just-3-lines-of-css/
它也适用于这种情况.子div将具有position:absolute,所以我们必须设置position:parent相对于parent,因此它们相对于它定位,而且parent也需要设置width和height,因为内容不会再自动设置它.
td.rotate {
position: relative;
height: 150px;
width: 15px;
}
td.rotate div {
transform: translate(-50%, -50%) rotate(270deg);
white-space: nowrap;
top: 50%;
left: 50%;
position: absolute;
text-align: center;
}
ABC
| 123 |
ABCDEFGHIJ
|