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/caption-side | |
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/caption-side')
-rw-r--r-- | files/zh-cn/web/css/caption-side/index.html | 147 |
1 files changed, 147 insertions, 0 deletions
diff --git a/files/zh-cn/web/css/caption-side/index.html b/files/zh-cn/web/css/caption-side/index.html new file mode 100644 index 0000000000..f05be3134d --- /dev/null +++ b/files/zh-cn/web/css/caption-side/index.html @@ -0,0 +1,147 @@ +--- +title: caption-side +slug: Web/CSS/caption-side +tags: + - CSS + - CSS 属性 + - table + - 参考 + - 表格 +translation_of: Web/CSS/caption-side +--- +<div>{{CSSRef}}</div> + +<p><a href="/zh-CN/CSS">CSS </a>中 <strong><code>caption-side</code></strong> 属性会将表格的标题{{HTMLElement("caption")}} 放到规定的位置。但是具体显示的位置与表格的 {{cssxref('writing-mode')}} 属性值有关。</p> + +<div>{{EmbedInteractiveExample("pages/css/caption-side.html")}}</div> + + + +<h2 id="语法">语法</h2> + +<p> <code>caption-side</code> 属性的取值必须是下面所列值中的一个。</p> + +<h3 id="CSS">CSS</h3> + +<pre class="brush: css">/* Directional values */ +caption-side: top; +caption-side: bottom; + +/* Warning: non-standard values */ +caption-side: left; +caption-side: right; +caption-side: top-outside; +caption-side: bottom-outside; + +/* Global values */ +caption-side: inherit; +caption-side: initial; +caption-side: unset; +</pre> + +<h3 id="取值">取值</h3> + +<dl> + <dt><code>top</code></dt> + <dd>标题会出现在表格的上方。</dd> + <dt><code>bottom</code></dt> + <dd>标题会出现在表格的下方。</dd> + <dt><code>left</code> {{non-standard_inline}}</dt> + <dd>标题会出现在表格的左侧。</dd> + <dd> + <div class="note">在CSS 2 阶段,这个值被建议加入到规范中,但是在在最终的CSS 2.1 规范中被移除。它是非标准属性。</div> + </dd> + <dt><code>right</code> {{non-standard_inline}}</dt> + <dd>标题会出现在表格的右侧。</dd> + <dd> + <div class="note">在CSS 2 阶段,这个值被建议加入到规范中,但是在在最终的CSS 2.1 规范中被移除。它是非标准属性。</div> + </dd> + <dt><code>top-outside</code> {{non-standard_inline}}</dt> + <dd>标题会被放置在表格上方,但是标题的宽度和水平对齐方式不受表格水平布局的约束。</dd> + <dd> + <div class="note">在CSS 2.1 规范中提到:CSS 2 规范中对 <code>top</code> 值产生的效果有不同的定义,在未来可能会重新定义这个值产生的影响效果。</div> + </dd> + <dt><code>bottom-outside</code> {{non-standard_inline}}</dt> + <dd>标题会被放置在表格下方,但是标题的宽度和水平对齐方式不受表格水平布局的约束。</dd> + <dd> + <div class="note">在CSS 2.1 规范中提到:CSS 2 规范中对 <code>top</code> 值产生的效果有不同的定义,在未来可能会重新定义这个值产生的影响效果。</div> + </dd> +</dl> + +<h2 id="示例">示例</h2> + +<h3 id="HTML">HTML</h3> + +<pre class="brush: html"><table class="top"> + <caption>Caption ABOVE the table</caption> + <tr> + <td>Some data</td> + <td>Some more data</td> + </tr> +</table> + +<br> + +<table class="bottom"> + <caption>Caption BELOW the table</caption> + <tr> + <td>Some data</td> + <td>Some more data</td> + </tr> +</table> +</pre> + +<h3 id="CSS_2">CSS</h3> + +<pre class="brush: css">.top caption { + caption-side: top; +} + +.bottom caption { + caption-side: bottom; +} + +table { + border: 1px solid red; +} + +td { + border: 1px solid blue; +} +</pre> + +<h3 id="结果">结果</h3> + +<p>{{EmbedLiveSample('Example', 'auto', 160)}}</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('CSS Logical Properties', '#caption-side', 'caption-side') }}</td> + <td>{{ Spec2('CSS Logical Properties') }}</td> + <td> + <p>定义和css定义的书写模式值相关的顶部及底部的值。</p> + </td> + </tr> + <tr> + <td>{{ SpecName('CSS2.1', 'tables.html#caption-position', 'caption-side') }}</td> + <td>{{ Spec2('CSS2.1') }}</td> + <td>初始版本。</td> + </tr> + </tbody> +</table> + +<h2 id="浏览器兼容性">浏览器兼容性</h2> + + + +<p>{{Compat("css.properties.caption-side")}}</p> |