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:34

#myDiv{
text-align: center;
}

#mySpan{
writing-mode: vertical-lr; 
transform: rotate(180deg);
}
<div id="myDiv"> 

<span id="mySpan"> Here We gooooo !!! </span>

</div>

enter image description here

查看更多
何必那么认真
3楼-- · 2019-01-03 13:34

Try using an SVG file, it seems to have better browser compatibility, and won't break your responsive designs.

I tried the CSS transform, and had much trouble with the transform-origin; and ended up going with an SVG file. It took like 10 minutes, and I could control it a bit with CSS too.

You can use Inkscape to make the SVG if you don't have Adobe Illustrator.

查看更多
相关推荐>>
4楼-- · 2019-01-03 13:36

Add the class

.rotate {
        -webkit-transform: rotate(-90deg);
        -moz-transform: rotate(-90deg);

}

I use this pretty much everyday and not had any issues whatsoever with it.

https://css-tricks.com/snippets/css/text-rotation/

查看更多
登录 后发表回答