From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/zh-cn/web/css/word-break/index.html | 140 ++++++++++++++++++++++++++++++ 1 file changed, 140 insertions(+) create mode 100644 files/zh-cn/web/css/word-break/index.html (limited to 'files/zh-cn/web/css/word-break/index.html') 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 +--- +
{{CSSRef}}
+ +

 CSS 属性 word-break 指定了怎样在单词内断行。

+ +
{{EmbedInteractiveExample("pages/css/word-break.html")}}
+ + + +

语法

+ +
/* 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;
+ +

+ +
+
normal
+
使用默认的断行规则。
+
break-all
+
对于non-CJK (CJK 指中文/日文/韩文) 文本,可在任意字符间断行。
+
keep-all
+
CJK 文本不断行。 Non-CJK 文本表现同 normal
+
break-word {{Deprecated_Inline}}
+
他的效果是word-break: normal 和 overflow-wrap: anywhere  的合,不论 {{cssxref("overflow-wrap")}}的值是多少。
+
+ +
+

注意:与 word-break: break-wordoverflow-wrap: break-word(详见 {{cssxref("overflow-wrap")}})对比,word-break: break-word 将在文本可能溢出其容器的确切位置创建一个断点。

+
+ +

规范

+ +

{{CSSInfo}}

+ +

正式语法

+ +
{{csssyntax}}
+
+ +

示例

+ +

HTML

+ +
<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>
+ +

CSS

+ +
.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;
+}
+ +

{{EmbedLiveSample('Examples', '100%', 600)}}

+ +

规范

+ + + + + + + + + + + + + + + + +
规范状态注释
{{SpecName('CSS3 Text', '#word-break-property', 'word-break')}}{{Spec2('CSS3 Text')}}Initial definition
+ +

浏览器兼容性

+ + + +

{{Compat("css.properties.word-break")}}

+ +

相关链接

+ + -- cgit v1.2.3-54-g00ecf