用CSS打破长字 [英] Break long word with CSS

查看:175
本文介绍了用CSS打破长字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个情况,其中可能有长的词像'hellowordsometext'或整数像'1234567891122'之间没有任何空格。请检查这个js。 http://jsfiddle.net/rzq5e/6/

I have a situation where there can be long words like 'hellowordsometext' or integer like '1234567891122' without any space in between. check this js please. http://jsfiddle.net/rzq5e/6/

在到达div宽度后,如何将它折入下一行。

how is it possible to break it in to next line after it reach the div width. what happens now is, it spans out out along with th div

<div>Solutionforentprise</div>


推荐答案

您需要的是 -wrap:break-word; ,此属性将强制非空格字符串在 div

What you need is word-wrap: break-word;, this property will force the non spaced string to break inside the div

演示

div {
   width: 20px;
   word-wrap: break-word;
}

这篇关于用CSS打破长字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆