2016-02-23 57 views
0

我有一个随机生成的内容,大大调整元素的大小。我通过javascript pusher.js库css:内联css停止调整父母的大小内容

<span class="msg" style="font-style:italic;width:30%;min-wdith:30%;max-width:30%;"> random length msg here </span><br> 

我想有它固定在30%,但每当文本字符串味精获取超长跨度最终延伸到网页的远端水平

实时接收封邮件

这是问题,因为味精率增加时,元素,“舞蹈”

+0

错字:'min-wdith:30%;'。另外,重复? http://stackoverflow.com/questions/621401/css-width-of-a-span-tag –

+0

修复它,但没有骰子。 – user299709

+0

[如何在DIV中强制换行符中的换行符?]的可能的重复(http://stackoverflow.com/questions/3058866/how-to-force-a-line-break-in-a-loooooong -word-IN-A-DIV) – Blazemonger

回答

2

您需要跨度的display属性更改为inline-block

Demo

.msg{ 
    display: inline-block; 
}