HTML
<wbr>
element
represents a word break opportunity—a position within text where the browser may optionally break a line, though its line-breaking rules would not otherwise create a break at that location.
| 内容类别 | 流内容 , 措词内容 . |
|---|---|
| 准许内容 | Empty |
| Tag omission | It is an empty element ; it must have a start tag, but must not have an end tag. |
| Permitted parents | Any element that accepts 措词内容 . |
| Implicit ARIA role | 无对应角色 |
| Permitted ARIA roles | 任何 |
| DOM 接口 |
HTMLElement
|
此元素只包括 全局属性 .
On UTF-8 encoded pages,
<wbr>
behaves like the
U+200B
ZERO-WIDTH SPACE
code point. In particular, it behaves like a Unicode bidi BN code point, meaning it has no effect on
bidi
-ordering:
<div dir=rtl>123,<wbr>456</div>
displays, when not broken on two lines,
123,456
和不
456,123
.
For the same reason, the
<wbr>
element does not introduce a hyphen at the line break point. To make a hyphen appear only at the end of a line, use the soft hyphen character entity (
­
) 代替。
This element was first implemented in Internet Explorer 5.5 and was officially defined in HTML5.
The Yahoo Style Guide recommends breaking a URL before punctuation , to avoid leaving a punctuation mark at the end of the line, which the reader might mistake for the end of the URL.
<p>http://this<wbr>.is<wbr>.a<wbr>.really<wbr>.long<wbr>.example<wbr>.com/With<wbr>/deeper<wbr>/level<wbr>/pages<wbr>/deeper<wbr>/level<wbr>/pages<wbr>/deeper<wbr>/level<wbr>/pages<wbr>/deeper<wbr>/level<wbr>/pages<wbr>/deeper<wbr>/level<wbr>/pages</p>
| 规范 | 状态 | 注释 |
|---|---|---|
|
HTML 实时标准
The definition of '<wbr>' in that specification. |
实时标准 | |
|
HTML5
The definition of '<wbr>' in that specification. |
推荐 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
wbr
|
Chrome 完整支持 1 | Edge 完整支持 79 | Firefox 完整支持 1 | IE 不支持 5.5 — 7 | Opera 完整支持 11.6 | Safari 完整支持 4 | WebView Android 完整支持 Yes | Chrome Android 完整支持 Yes | Firefox Android 完整支持 4 | Opera Android ? | Safari iOS ? | Samsung Internet Android 完整支持 Yes |
完整支持
不支持
兼容性未知
overflow-wrap
word-break
hyphens
<br>
element