2013-07-05 68 views
0

我有类似这样的一些HTML,CSS: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。 我无法弄清楚如何做到这一点,任何帮助将不胜感激!

回答

1

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

<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> 
+0

谢谢,但是当窗口小到“宽度:100%”和更多的文本时,这不起作用。这里是一个例子:http://bartel.ws/调整窗口大小并观察底部的图标。 – tobiasbartel

相关问题