html5 word wrap,word-wrap

overflow-wrap属性用于指定浏览器是否可以在单词内部断行,以防止长字符串无法在包含框内正常显示。主要值包括normal和break-word。此属性在不同浏览器的兼容性存在差异,例如在旧版IE中可以通过-ms-word-wrap进行兼容。CSS的word-wrap属性现已被重命名为overflow-wrap,但word-wrap仍可使用作为其别名。
摘要由CSDN通过智能技术生成

word-wrap

The overflow-wrap property is used to specify whether or not the browser may break lines within words in order to prevent overflow when an otherwise unbreakable string is too long to fit in its containing box. /* Keyword values */

overflow-wrap: normal;

overflow-wrap: break-word;

/* Global values */

overflow-wrap: inherit;

overflow-wrap: initial;

overflow-wrap: unset;

Note: Originally a Microsoft (unprefixed) proprietary extension called word-wrap, and implemented by most browsers, it has been renamed to overflow-wrap. The original name word-wrap is now considered an "alternate name" for overflow-wrap. Applies to

all elements

Media

visual

Animation type

discrete

Canonical order

the unique non-ambiguous order defined by the formal grammar

Syntax

The overflow-wrap property is specified as a single keyword chosen from the list of values below.

Values normal Indicates that lines may only break at normal word break points. break-word Indicates that normally unbreakable words may be broken at arbitrary points if there are no otherwise acceptable break points in the line.

Formal syntax normal | break-word

Examples

CSS .normal {

width: 13em;

background: gold;

}

.breakWord {

width: 13em;

background: gold;

overflow-wrap: break-word;

}

HTML

FStrPrivFinÄndG (Gesetz zur Änderung des Fernstraßenbauprivatfinanzierungsgesetzes und straßenverkehrsrechtlicher Vorschriften)

FStrPrivFinÄndG (Gesetz zur Änderung des Fernstraßenbauprivatfinanzierungsgesetzes und straßenverkehrsrechtlicher Vorschriften)

Result

Specifications

Browser compatibility

Feature Firefox (Gecko) Chrome Edge Internet Explorer Opera Safari

Basic support (as word-wrap) 3.5 (1.9.1) 1.0 (Yes) 5.5 10.5 1.0

overflow-wrap 49 (49) (Yes) No support ? (Yes) ?

Feature Firefox Mobile (Gecko) Android Edge IE Mobile Opera Mobile Safari Mobile

Basic support (as word-wrap) 1.0 (1.9.1) 1.0 (Yes) ? ? 1.0

overflow-wrap 49 (49) (Yes) No support ? (Yes) ? word-wrap:break-wordcan be used to work around lack ofpre{white-space:pre-wrap}support in IE 5.5-7. See white-space for an example.

IE8 introduced-ms-word-wrapas a synonym forword-wrap. Don't use the -ms- prefix.

See also

© 2005–2017 Mozilla Developer Network and individual contributors.

Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.

https://developer.mozilla.org/en-US/docs/Web/CSS/word-wrap

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值