简体   繁体   English

如何在chrome上制作“”自动换行

[英]how to make “ ” word-wrap on chrome

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, 这个代码在firefox中自动换行,但在chrome中我不能自动换行,

so how to make &nbsp; 所以如何制作&nbsp; word-wrap on chrome ? Chrome上的自动换行?

thanks 谢谢

你让它们像这样包装:

 &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. 如果您想要自动换行,请使用普通空格。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM