A
character is a space which doesn't allow for line breaking.
一个,字符是不允许断行的空间。
<p>lorem ipsum here are some words and so on</p>
| lorem ipsum |
| here are some words and so |
| on |
What's the opposite of that? That is, a character which is NOT rendered as a space, but CAN be used for line breaking.
它的反义词是什么?也就是说,不是作为空间呈现的字符,但是可以用于断行。
<p>foo supercalifragilisticexpialidocious bar</p>
<!-- put char here ^ and here ^ -->
|foo supercalifragi |
|listicexpiali |
|docious bar |
or with wider size:
|foo supercalifragilisticexpiali |
|docious bar |
I'm aware of the soft-hyphen character, but for my purposes, I specifically do not want a hyphen added at the break.
我知道软连字符,但出于我的目的,我特别不希望在中断时添加连字符。
6 个解决方案
#1
92
You want the unicode character ZERO-WIDTH SPACE (\u200B).
需要unicode字符零宽度空间(\u200B)。
You can get it in HTML with ​
or ​
.
你可以用#8203获取它;或& # x200b;。
Explicit breaks and non-breaks:
明确的优惠和non-breaks:
LB7 : Do not break before spaces or zero width space.
LB8 : Break before any character following a zero-width space, even if one or more spaces intervene.
http://unicode.org/reports/tr14/LB7:不要在空格前或零宽度空格前断裂。LB8:在零宽度空间之前,即使有一个或多个空格进行干预,也要打破任何字符。http://unicode.org/reports/tr14/
#2
38
There also is the little-known wbr tag, which lets the browser to decide whether to break the line or not.
还有一个鲜为人知的wbr标签,它可以让浏览器决定是否打破常规。
#3
15
There's a nice page over at quirksmode.org that answers this question quite nicely IMHO. http://www.quirksmode.org/oddsandends/wbr.html
在quirksmode.org上有一个很好的页面可以很好地回答这个问题。http://www.quirksmode.org/oddsandends/wbr.html
In short: use <wbr /> or ​ (or ­ but you mentioned you don't want the dash).
简而言之:使用
#5
1
You can use CSS3 property called word-wrap
您可以使用CSS3属性,称为词包
p.test {word-wrap:break-word;}
Hope it helps!
希望它可以帮助!
#6
-4
theres a lot of discussion about this but it has become more or less standard to use ­
关于这个问题有很多讨论,但它或多或少已经成为使用和害羞的标准;
#1
92
You want the unicode character ZERO-WIDTH SPACE (\u200B).
需要unicode字符零宽度空间(\u200B)。
You can get it in HTML with ​
or ​
.
你可以用#8203获取它;或& # x200b;。
Explicit breaks and non-breaks:
明确的优惠和non-breaks:
LB7 : Do not break before spaces or zero width space.
LB8 : Break before any character following a zero-width space, even if one or more spaces intervene.
http://unicode.org/reports/tr14/LB7:不要在空格前或零宽度空格前断裂。LB8:在零宽度空间之前,即使有一个或多个空格进行干预,也要打破任何字符。http://unicode.org/reports/tr14/
#2
38
There also is the little-known wbr tag, which lets the browser to decide whether to break the line or not.
还有一个鲜为人知的wbr标签,它可以让浏览器决定是否打破常规。
#3
15
There's a nice page over at quirksmode.org that answers this question quite nicely IMHO. http://www.quirksmode.org/oddsandends/wbr.html
在quirksmode.org上有一个很好的页面可以很好地回答这个问题。http://www.quirksmode.org/oddsandends/wbr.html
In short: use <wbr /> or ​ (or ­ but you mentioned you don't want the dash).
简而言之:使用
#4
#5
1
You can use CSS3 property called word-wrap
您可以使用CSS3属性,称为词包
p.test {word-wrap:break-word;}
Hope it helps!
希望它可以帮助!
#6
-4
theres a lot of discussion about this but it has become more or less standard to use ­
关于这个问题有很多讨论,但它或多或少已经成为使用和害羞的标准;