diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/css/word-break/index.html | |
parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip |
initial commit
Diffstat (limited to 'files/zh-cn/web/css/word-break/index.html')
-rw-r--r-- | files/zh-cn/web/css/word-break/index.html | 140 |
1 files changed, 140 insertions, 0 deletions
diff --git a/files/zh-cn/web/css/word-break/index.html b/files/zh-cn/web/css/word-break/index.html new file mode 100644 index 0000000000..b372b6b594 --- /dev/null +++ b/files/zh-cn/web/css/word-break/index.html @@ -0,0 +1,140 @@ +--- +title: word-break +slug: Web/CSS/word-break +tags: + - CSS + - CSS 属性 +translation_of: Web/CSS/word-break +--- +<div>{{CSSRef}}<br> + </div> + +<p> CSS 属性 <code>word-break</code> 指定了怎样在单词内断行。</p> + +<div>{{EmbedInteractiveExample("pages/css/word-break.html")}}</div> + + + +<h2 id="语法">语法</h2> + +<pre class="notranslate">/* Keyword values */ +word-break: normal; +word-break: break-all; +word-break: keep-all; +word-break: break-word; /* deprecated */ + +/* Global values */ +word-break: inherit; +word-break: initial; +word-break: unset;</pre> + +<h3 id="值">值</h3> + +<dl> + <dt><code>normal</code></dt> + <dd>使用默认的断行规则。</dd> + <dt><code>break-all</code></dt> + <dd>对于non-CJK (CJK 指中文/日文/韩文) 文本,可在任意字符间断行。</dd> + <dt><code>keep-all</code></dt> + <dd>CJK 文本不断行。 Non-CJK 文本表现同 <code>normal</code>。</dd> + <dt><code>break-word</code> {{Deprecated_Inline}}</dt> + <dd>他的效果是<code>word-break: normal</code> 和 <code>overflow-wrap: anywhere</code> 的合,不论 {{cssxref("overflow-wrap")}}的值是多少。</dd> +</dl> + +<div class="blockIndicator note"> +<p>注意:与 <code>word-break: break-word</code> 和 <code>overflow-wrap: break-word</code>(详见 {{cssxref("overflow-wrap")}})对比,<code>word-break: break-word</code> 将在文本可能溢出其容器的确切位置创建一个断点。</p> +</div> + +<h2 id="规范">规范</h2> + +<p>{{CSSInfo}}</p> + +<h2 id="正式语法">正式语法</h2> + +<pre class="syntaxbox notranslate">{{csssyntax}} +</pre> + +<h2 id="示例">示例</h2> + +<h3 id="HTML">HTML</h3> + +<pre class="brush: html notranslate"><p>1. <code>word-break: normal</code></p> +<p class="normal narrow">This is a long and + Honorificabilitudinitatibus califragilisticexpialidocious Taumatawhakatangihangakoauauotamateaturipukakapikimaungahoronukupokaiwhenuakitanatahu + グレートブリテンおよび北アイルランド連合王国という言葉は本当に長い言葉</p> + +<p>2. <code>word-break: break-all</code></p> +<p class="breakAll narrow">This is a long and + Honorificabilitudinitatibus califragilisticexpialidocious Taumatawhakatangihangakoauauotamateaturipukakapikimaungahoronukupokaiwhenuakitanatahu + グレートブリテンおよび北アイルランド連合王国という言葉は本当に長い言葉</p> + +<p>3. <code>word-break: keep-all</code></p> +<p class="keepAll narrow">This is a long and + Honorificabilitudinitatibus califragilisticexpialidocious Taumatawhakatangihangakoauauotamateaturipukakapikimaungahoronukupokaiwhenuakitanatahu + グレートブリテンおよび北アイルランド連合王国という言葉は本当に長い言葉</p> + +<p>4. <code>word-break: break-word</code></p> +<p class="breakWord narrow">This is a long and + Honorificabilitudinitatibus califragilisticexpialidocious Taumatawhakatangihangakoauauotamateaturipukakapikimaungahoronukupokaiwhenuakitanatahu + グレートブリテンおよび北アイルランド連合王国という言葉は本当に長い言葉</p></pre> + +<h3 id="CSS">CSS</h3> + +<pre class="notranslate">.narrow { + padding: 10px; + border: 1px solid; + width: 500px; + margin: 0 auto; + font-size: 20px; + line-height: 1.5; + letter-spacing: 1px; +} + +.normal { + word-break: normal; +} + +.breakAll { + word-break: break-all; +} + +.keepAll { + word-break: keep-all; +} + +.breakWord { + word-break: break-word; +}</pre> + +<p>{{EmbedLiveSample('Examples', '100%', 600)}}</p> + +<h2 id="规范_2">规范</h2> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">规范</th> + <th scope="col">状态</th> + <th scope="col">注释</th> + </tr> + </thead> + <tbody> + <tr> + <td>{{SpecName('CSS3 Text', '#word-break-property', 'word-break')}}</td> + <td>{{Spec2('CSS3 Text')}}</td> + <td>Initial definition</td> + </tr> + </tbody> +</table> + +<h2 id="浏览器兼容性">浏览器兼容性</h2> + + + +<p>{{Compat("css.properties.word-break")}}</p> + +<h2 id="相关链接">相关链接</h2> + +<ul> + <li>{{cssxref("overflow-wrap")}}</li> +</ul> |