Vertical Text Direction

2019-01-03 12:39发布

I have been trying text to go in a vertical direction like we can do in ms-word tables but so far I have only been able to do THIS... which I am not happy with because it's a box rotated... Isn't there a way to have actual vertical direction text?

I only set the rotation to 305 degrees in the demo which doesn't make the text vertical. 270deg will but I only made the demo to show rotation.

21条回答
时光不老,我们不散
2楼-- · 2019-01-03 13:18
h1{word-break:break-all;display:block;width:40px;} 

H E L L O

NOTE: Browser Supported - IE browser (8,9,10,11) - Firefox browser (38,39,40,41,42,43,44) - Chrome browser (44,45,46,47,48) - Safari browser (8,9) - Opera browser (Not Supported) - Android browser (44)

查看更多
戒情不戒烟
3楼-- · 2019-01-03 13:19

For vertical text with characters one below another in firefox use:

text-orientation: upright;
writing-mode: vertical-rl;
查看更多
男人必须洒脱
4楼-- · 2019-01-03 13:19

I'm new at this, it helped me a lot. Just change width, height, top and left to make it fit:

.vertical-text {
display: block;
position:absolute;
width: 0px;
height: 0px;
top: 0px;
left: 0px;
transform: rotate(90deg);
}

You can also go here and see another way to do it. The author does it like this:

.vertical-text {
transform: rotate(90deg);
transform-origin: left top 0;
float: left;
}
查看更多
We Are One
5楼-- · 2019-01-03 13:20

You can use word-wrap:break-word to get vertical text use following snippete

HTML:

<div class='verticalText mydiv'>Here is your text</div>

css:

.verticalText {
word-wrap: break-word;
  font-size: 18px;
}
.mydiv {
  height: 300px;
  width: 10px;
}
查看更多
祖国的老花朵
6楼-- · 2019-01-03 13:22

Try using:

writing-mode: lr-tb;
查看更多
The star\"
7楼-- · 2019-01-03 13:23

Can use CSS3 Transform property

.txtdiv{
  transform:rotate(7deg);
  -ms-transform:rotate(7deg); /* IE 9 */
  -ms-filter: "progid:DXImageTransform.Microsoft.Matrix(M11=0.93969262, M12=0.34202014, M21=-0.34202014, M22=0.93969262,sizingMethod='auto expand')"; /* IE6-8 */
  -webkit-transform:rotate(7deg); /* Opera, Chrome, and Safari */
}
查看更多
登录 后发表回答