简体   繁体   English

如何对齐表格中的旋转文本?

[英]How to align rotated text in the table?

I found out how to rotate the text (thanks to SO) by 90°, the problem is the text is rendered vertically, but (I guess) the box is calculated horizontally (as before rotating). 我发现如何将文本(感谢SO)旋转90°,问题是文本是垂直渲染的,但(我猜)框是水平计算的(如旋转之前 )。

I have table cell which contains such rotated text, and I would like to align the text at top of the cell. 我有包含这种旋转文本的表格单元格,我想将文本对齐在单元格的顶部。 As the result I get something like this: 结果我得到这样的东西:

Text before rotation: 轮换前的文字:

rotated90

Text after rotation (please excuse my ASCII screenshot): 轮换后的文字(请原谅我的ASCII截图):

0
9
d
e
t
a
t
o
r

Rotated text aligned to top of the cell: 旋转文本与单元格顶部对齐:

0
9
d
e
-----------
t
a
t
o
r

So part of the text is above the cell actually, which is bad. 因此,部分文本实际上位于单元格之上,这很糟糕。

Desired effect: 期望的效果:

-----------
0
9
d
e
t
a
t
o
r

QUESTION : how to align text vertically, ie how to make browser see the box as after (not before) rotattion? 问题 :如何垂直对齐文本,即如何使浏览器在旋转后(不是之前)看到框?

It doesn't look like this is possible without specifying the height of the cell that the rotated text is in. 如果没有指定旋转文本所在单元格的高度,则看起来不可能。

Webkit/Mozilla performs the rotation on the element's display, but not its box model. Webkit / Mozilla在元素的显示上执行旋转,但不在其框模型上执行旋转。

The CSS3 property writing-mode works properly in IE, rotating the box model. CSS3属性writing-mode在IE中正常工作,旋转盒子模型。 This property should be supported by most browsers, but the article I read said it was only supported by IE at the time. 大多数浏览器都应支持此属性,但我读过的文章说它当时仅受IE支持。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM