如何在 CSS 中使文本从上到下运行?
有谁知道如何使 div 中的文本从上到下对齐。
所以甚至不让我演示它。 。 。 我只是希望这些字母在页面上垂直排列,就像建筑物的故事一样。 希望我不需要用图像来做。
Does anyone know how to make text align top-to-bottom in a div.
SO won't even let me demonstrate it . . . I just want the letters to stack on top of each other in a vertical line down the page like the stories of a building. Was hoping I didn't need to do it with an image.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
让文本沿垂直线排列,无需修改
writing-mode
CSS
writing-mode
属性 让您的文本垂直排列。text-orientation
如果您不希望非垂直书写的字母在垂直方向上旋转,您可以使用 CSS
text-orientation
属性。如果你想做一些tate-chuu-yoko[1][2][3] (縦中横;垂直书写时有点水平书写),
考虑使用
text-combine-upright
。Having your text run along vertical lines WITHOUT HACKS
writing-mode
CSS
writing-mode
attribute lets your text run vertically.text-orientation
If you don't want non-vertical-writing letters to rotate themselves in vertical lines, you may use CSS
text-orientation
attribute as well.And if you’re to do some tate-chuu-yoko[1][2][3] (縦中横; a bit of horizontal writing while writing vertically),
consider using
text-combine-upright
.要使字母从上到下同时保持其正常方向,如下所示:
F
O
O
HTML:
CSS:
自动换行允许单词在中间断开,因此这将使字母从上到下。 它也得到了很好的支持: https://developer.mozilla.org/en -US/docs/CSS/自动换行
To make the letters top-to-bottom while keeping their normal orientation, like this:
F
O
O
HTML:
CSS:
word-wrap allows words to be broken in the middle, so this will make the letters top-to-bottom. It's also really well supported: https://developer.mozilla.org/en-US/docs/CSS/word-wrap
Html:
CSS:
Html:
Css:
这是我使用过的,它对我有用:
CSS
HTML,记住将文本放在
标签
结果 中
This is what I have used and it works for me:
CSS
HTML, Remember to put your text in
tag
RESULTS
NJCodeMonkey 的答案很接近。
对我来说,我必须使用
word-break
。 它与word-wrap:break-word;
有点不同所以它看起来像这样。
HTML:
CSS:
这在 Firefox 24、IE 8 和 IE 11 中对我有用。
NJCodeMonkey's answer was close.
For me I had to use
word-break
. It's a little different fromword-wrap:break-word;
So it would look like this.
HTML:
CSS:
This worked for me in Firefox 24, IE 8 and IE 11.
根据您的字体大小进行相应调整:
Depending on your font size, adjust accordingly: