aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/css/text-justify
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/css/text-justify
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/zh-cn/web/css/text-justify')
-rw-r--r--files/zh-cn/web/css/text-justify/index.html174
1 files changed, 174 insertions, 0 deletions
diff --git a/files/zh-cn/web/css/text-justify/index.html b/files/zh-cn/web/css/text-justify/index.html
new file mode 100644
index 0000000000..db387c6f37
--- /dev/null
+++ b/files/zh-cn/web/css/text-justify/index.html
@@ -0,0 +1,174 @@
+---
+title: text-justify
+slug: Web/CSS/text-justify
+tags:
+ - CSS文字
+ - 布局
+ - 排版
+translation_of: Web/CSS/text-justify
+---
+<div>{{CSSRef}}</div>
+
+<div></div>
+
+<p>CSS属性 <strong><code>text-justify</code> </strong>定义的是当文本的 {{cssxref("text-align")}} 属性被设置为 <code>:justify</code> 时的齐行方法。</p>
+
+<pre class="brush: css no-line-numbers notranslate">text-justify: none;
+text-justify: auto;
+text-justify: inter-word;
+text-justify: inter-character;
+text-justify: distribute; /* 已被废除,不提倡使用 */
+</pre>
+
+<p>{{cssinfo}}</p>
+
+<h2 id="语法">语法</h2>
+
+<p><code>text-justify</code> 属性的值只能取下面列表中的单个关键词值。</p>
+
+<h3 id="值">值</h3>
+
+<dl>
+ <dt><code>none</code></dt>
+ <dd>表示关闭掉齐行的设置。表现的效果和没有设置 {{cssxref("text-align")}} 一样,当你因为某种原因需要在已经设置了 {{cssxref("text-align")}} 的元素上禁用齐行效果的时候,这个属性值很有用。</dd>
+ <dd>译者注:经过测试,在谷歌(v 58.0.3029.110)下的表现与在火狐下的表现是不一样的,火狐下使用 <code>none</code> 属性时,的确可以禁用掉齐行设置,但是谷歌下还是没有设置 <code>none</code> 属性时的效果。</dd>
+ <dt><code>auto</code></dt>
+ <dd>默认值,浏览器根据显示的效果和质量来确定符合当前状态的最佳对齐方式,当然这种对齐方式将是最适合某种语言文字的排版(例如:英语,中文,日语,韩语等)。如果没有对 <code>text-justify</code> 进行设置的话,则是默认使用这样子的对齐规则。</dd>
+ <dt><code>inter-word</code></dt>
+ <dd>通过在文本中的单词之间添加空间来实现行对齐(这将会改变 {{cssxref("word-spacing")}} 的值),比如英语或韩语就是最适合使用这个属性来用空格分隔单词的语言。</dd>
+ <dt><code>inter-character</code></dt>
+ <dd>The text is justified by adding space between characters (effectively varying {{cssxref("letter-spacing")}}), which is most appropriate for languages like Japanese.</dd>
+ <dd>通过在文本中的字符之间添加空间来实现行对齐(这将会改变 {{cssxref("letter-spacing")}} 的值),比如日语就是最适合使用这个属性的语言。</dd>
+ <dt><code>distribute </code>{{deprecated_inline}}</dt>
+ <dd>显示效果与设置了 <code>inter-word</code> 一致,不提倡使用这个属性,现在这个属性或许还能有效果,但那完全是为了向后兼容而被保留着。</dd>
+</dl>
+
+<h3 id="语法_2">语法</h3>
+
+<pre class="syntaxbox notranslate">{{csssyntax}}</pre>
+
+<h2 id="示例">示例</h2>
+
+<div class="hidden">
+<pre class="brush: html notranslate">&lt;p class="none"&gt;&lt;code&gt;text-justify: none&lt;/code&gt; —&lt;br&gt;Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc ornare maximus vehicula. Duis nisi velit, dictum id mauris vitae, lobortis pretium quam. Quisque sed nisi pulvinar, consequat justo id, feugiat leo. Cras eu elementum dui.&lt;/p&gt;
+&lt;p class="auto"&gt;&lt;code&gt;text-justify: auto&lt;/code&gt; —&lt;br&gt;Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc ornare maximus vehicula. Duis nisi velit, dictum id mauris vitae, lobortis pretium quam. Quisque sed nisi pulvinar, consequat justo id, feugiat leo. Cras eu elementum dui.&lt;/p&gt;
+&lt;p class="dist"&gt;&lt;code&gt;text-justify: distribute&lt;/code&gt; —&lt;br&gt;Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc ornare maximus vehicula. Duis nisi velit, dictum id mauris vitae, lobortis pretium quam. Quisque sed nisi pulvinar, consequat justo id, feugiat leo. Cras eu elementum dui.&lt;/p&gt;
+&lt;p class="word"&gt;&lt;code&gt;text-justify: inter-word&lt;/code&gt; —&lt;br&gt;Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc ornare maximus vehicula. Duis nisi velit, dictum id mauris vitae, lobortis pretium quam. Quisque sed nisi pulvinar, consequat justo id, feugiat leo. Cras eu elementum dui.&lt;/p&gt;
+&lt;p class="char"&gt;&lt;code&gt;text-justify: inter-character&lt;/code&gt; —&lt;br&gt;Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc ornare maximus vehicula. Duis nisi velit, dictum id mauris vitae, lobortis pretium quam. Quisque sed nisi pulvinar, consequat justo id, feugiat leo. Cras eu elementum dui.&lt;/p&gt;</pre>
+</div>
+
+<pre class="brush: css notranslate">p {
+ font-size: 1.5em;
+ border: 1px solid black;
+ padding: 10px;
+ width: 95%;
+ margin: 10px auto;
+ text-align: justify;
+}
+
+.none {
+ text-justify: none;
+}
+
+.auto {
+ text-justify: auto;
+}
+
+.dist {
+ text-justify: distribute;
+}
+
+.word {
+ text-justify: inter-word;
+}
+
+.char {
+ text-justify: inter-character;
+}</pre>
+
+<p>{{EmbedLiveSample("示例","100%",400)}}</p>
+
+<h2 id="规范">规范</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', '#text-justify-property', 'text-justify')}}</td>
+ <td>{{Spec2('CSS3 Text')}}</td>
+ <td></td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="浏览器兼容性">浏览器兼容性</h2>
+
+<p>{{CompatibilityTable}}</p>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Edge</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatNo}}<sup>[2]</sup></td>
+ <td>14<sup>[1]</sup></td>
+ <td>{{CompatGeckoDesktop("55.0")}}</td>
+ <td>11<sup>[1]</sup></td>
+ <td>{{CompatNo}}<sup>[2]</sup></td>
+ <td>{{CompatNo}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Chrome for Android</th>
+ <th>Edge</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatNo}}<sup>[2]</sup></td>
+ <td>{{CompatNo}}<sup>[2]</sup></td>
+ <td>14<sup>[1]</sup></td>
+ <td>{{CompatGeckoMobile("55.0")}}</td>
+ <td>11<sup>[1]</sup></td>
+ <td>{{CompatNo}}<sup>[2]</sup></td>
+ <td>{{CompatNo}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<p>[1] 不支持标准属性值 <code>inter-character</code> 或 <code>none</code> 。但是支持过时的属性值 <code>distribute</code>和废弃属性值 <code>distribute-all-lines</code>、<code>distribute-center-last</code>、<code>inter-cluster</code>、<code>inter-ideograph</code>,以及 <code>newspaper</code>。</p>
+
+<p>[2] 参照了默认的规范,属性值 <code>inter-word</code> 和 <code>distribute</code> 在“实验平台特性”的旗帜下被保留了下来,尽管 <code>distribulte</code> 已经不被提倡使用了。</p>
+
+<h2 id="参见">参见</h2>
+
+<ul>
+ <li>{{cssxref("text-align")}}</li>
+</ul>