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/text-indent | |
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/text-indent')
-rw-r--r-- | files/zh-cn/web/css/text-indent/index.html | 116 |
1 files changed, 116 insertions, 0 deletions
diff --git a/files/zh-cn/web/css/text-indent/index.html b/files/zh-cn/web/css/text-indent/index.html new file mode 100644 index 0000000000..75314be041 --- /dev/null +++ b/files/zh-cn/web/css/text-indent/index.html @@ -0,0 +1,116 @@ +--- +title: text-indent +slug: Web/CSS/text-indent +translation_of: Web/CSS/text-indent +--- +<div>{{CSSRef}}</div> + +<p><code>text-indent</code> 属性能定义一个块元素首行文本内容之前的缩进量。</p> + +<div>{{EmbedInteractiveExample("pages/css/text-indent.html")}}</div> + +<h2 id="Syntax">Syntax</h2> + +<pre><code>/* <length> 长度值 */ +text-indent: 3mm; +text-indent: 40px; + +/* <percentage>百分比值取决于其包含块(containing block)的宽度*/ +text-indent: 15%; + +/* 关键字 */ +text-indent: 5em each-line; +text-indent: 5em hanging; +text-indent: 5em hanging each-line; + +/* 全局值 */ +text-indent: inherit; +text-indent: initial; +text-indent: unset;</code></pre> + +<h3 id="Values">Values</h3> + +<dl> + <dt><code><length></code></dt> + <dd><code>使用固定的<length>值来指定文本的缩进。允许使用负值。查阅可能</code>的 {{cssxref("<length>")}} 单位。</dd> + <dt><code><percentage></code></dt> + <dd>使用包含块宽度的百分比作为缩进.</dd> + <dt><code>each-line</code> {{experimental_inline}}</dt> + <dd>文本缩进会影响第一行,以及使用<br>强制断行后的第一行。</dd> + <dt><code>hanging</code> {{experimental_inline}}</dt> + <dd>该值会对所有的行进行反转缩进:除了第一行之外的所有的行都会被缩进,看起来就像第一行设置了一个负的缩进值。</dd> +</dl> + +<h3 id="正式语法">正式语法</h3> + +<dl> + <dt> + <pre class="syntaxbox">{{csssyntax}} +</pre> + </dt> +</dl> + +<h2 id="例子">例子</h2> + +<h3 id="HTML">HTML</h3> + +<pre class="brush: html"><code><p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy + nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p></code></pre> + +<h3 id="CSS">CSS</h3> + +<pre class="brush: css"><code>p { + text-indent: 5em; + background: powderblue; +}</code> +</pre> + +<h3 id="结果">结果</h3> + +<p>{{EmbedLiveSample('例子')}}</p> + +<h2 id="规范">规范</h2> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + </thead> + <tbody> + <tr> + <td>{{SpecName('CSS3 Text', '#text-indent', 'text-indent')}}</td> + <td>{{Spec2('CSS3 Text')}}</td> + <td>Added the <code>hanging</code> and <code>each-line</code> keywords</td> + </tr> + <tr> + <td>{{SpecName('CSS3 Transitions', '#animatable-css', 'text-indent')}}</td> + <td>{{Spec2('CSS3 Transitions')}}</td> + <td>Lists <code>text-indent</code> as animatable.</td> + </tr> + <tr> + <td>{{SpecName('CSS2.1', 'text.html#indentation-prop', 'text-indent')}}</td> + <td>{{Spec2('CSS2.1')}}</td> + <td>The behavior with <code>display: inline-block</code> and anonymous block boxes have been explicitly defined.</td> + </tr> + <tr> + <td>{{SpecName('CSS1', '#text-indent', 'text-indent')}}</td> + <td>{{Spec2('CSS1')}}</td> + <td></td> + </tr> + </tbody> +</table> + +<p>{{cssinfo}}</p> + +<h2 id="浏览器兼容性">浏览器兼容性</h2> + +<div class="hidden"> +<p>The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p> +</div> + +<p>{{Compat("css.properties.text-indent")}}</p> + +<div id="compat-mobile"></div> |