html - CSS 居中多行文本但最短的行在最上面?

标签 html css text alignment

我有一些类似这样的 html,css:

<div style="width: 40em; text-align: center;">
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy tex
</div>

呈现为 this但我希望最短的线在最上面,比如 this . 我无法弄清楚如何做到这一点,任何帮助将不胜感激!

最佳答案

Web 浏览器自动显示文本,直到 block 宽度结束。如果你想要不同的东西,你必须休息一下。

<div style="width: 40em; text-align: center;">
    Lorem Ipsum is simply dummy text<br>
    of the printing and typesetting industry. Lorem Ipsum has been the 
    industry's standard dummy tex
</div>

关于html - CSS 居中多行文本但最短的行在最上面?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17497448/

相关文章:

html - 带有图标的整个 div 应该是可点击的

php - 将中东语言的 doc 和 docx 文件批量转换为 utf-8 编码的 txt

python - 如何更改文本文件中的行?

css - 两个并排的内部 DIV,一个在中间

javascript - jQuery addClass 覆盖前一个元素

javascript - 选择 : Combine value of two or more select and get their combination as output

android - 在我的 Android 应用程序中以响应方式显示文档内容

javascript - 如何使背景图像在页面打开/刷新时慢慢模糊?

php - 不确定在哪里放置我的 honeytrap php 脚本

html - 通过具有背景颜色的 div 实现透明度