css - 如何垂直对齐文本

标签 css html

我在<aside></aside>里面有一段文字标签,现在它看起来像这样

This is the text in <aside>

我想让它看起来像这样垂直

T
h
i
s

i
s

t
h
e

t
e
x
t 

我正在使用这个 CSS

代码:

aside {
    background: none repeat scroll 0 0 #475E80;
    height: 690px;
    position: relative;
    width: 20px;
    text-align:bottom;
}

我该怎么做?

最佳答案

尝试添加 word-wrap 属性。您的 CSS 应如下所示:

aside {
    background: none repeat scroll 0 0 #475E80;
    height: 690px;
    position: relative;
    width: 0;
    word-wrap: break-word;
}

这是一个例子:http://jsfiddle.net/CkAFs/1/

您也可以使用 word-break: break-all 但浏览器对上述解决方案的支持略微更好。这是引用:http://caniuse.com/#search=word- (注意 overflow-wrap 属性是 word-wrap 的别名)。

关于css - 如何垂直对齐文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19633428/

相关文章:

javascript - 如何将可调整大小的 div 宽度读取到变量中 - Angular 4

css - 根据 .right 高度修改 .left 高度

css - 停止超链接继承 div 的宽度?

javascript - 启用禁用类时如何删除带圆圈的十字 Bootstrap HTML CSS

html - 溢出在此代码中不起作用

javascript - HTML5 视频加载时间

html - CSS 给表格添加边框

asp.net - HtmlEditor 导致不需要的断线

javascript - JQuery CSS 两个值

html - 当我在浏览器中测试代码时,无序列表不可见