最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - how to make " " word-wrap on chrome - Stack Overflow

programmeradmin2浏览0评论

this is my code :

<div id="a" style="position:absolute;top:300px;width:100px;height:100px;background:red;color:black;word-wrap:break-word;">
    <div id='a2' contenteditable=true >
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    </div>
</div>

this code word-wrap in firefox , but in chrome i cant word-wrap,

so how to make &nbsp; word-wrap on chrome ?

thanks

this is my code :

<div id="a" style="position:absolute;top:300px;width:100px;height:100px;background:red;color:black;word-wrap:break-word;">
    <div id='a2' contenteditable=true >
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    </div>
</div>

this code word-wrap in firefox , but in chrome i cant word-wrap,

so how to make &nbsp; word-wrap on chrome ?

thanks

Share Improve this question asked Nov 27, 2010 at 9:02 zjm1126zjm1126 35.7k53 gold badges125 silver badges167 bronze badges 1
  • 14 "nbsp" stands for "non-breaking space", so it looks like you're trying to suck and blow at the same time. Could you describe the problem you're actually trying to solve? – wlangstroth Commented Nov 27, 2010 at 12:37
Add a comment  | 

2 Answers 2

Reset to default 11

You make them word wrap like this:

 &nbsp;<wbr>&nbsp;<wbr>&nbsp;<wbr>&nbsp;<wbr>&nbsp;<wbr>

&nbsp; creates a non-breaking space. The purpose of a non-breaking space is to provide a space, while not counting as a place to break a line. (Which normal spaces are.)

Therefore, you cannot make them word-wrap, as they're designed to not do so. If you want word-wrapping, use normal spaces.

发布评论

评论列表(0)

  1. 暂无评论