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/column_combinator/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/column_combinator/index.html')
-rw-r--r-- | files/zh-cn/web/css/column_combinator/index.html | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/files/zh-cn/web/css/column_combinator/index.html b/files/zh-cn/web/css/column_combinator/index.html new file mode 100644 index 0000000000..1f665103f0 --- /dev/null +++ b/files/zh-cn/web/css/column_combinator/index.html @@ -0,0 +1,99 @@ +--- +title: Column combinator +slug: Web/CSS/Column_combinator +tags: + - CSS + - 参考 + - 合并器 + - 表格 + - 试验 + - 选择器 + - 需要浏览器的兼容性 +translation_of: Web/CSS/Column_combinator +--- +<div>{{CSSRef("Selectors")}}{{Draft}}{{SeeCompatTable}}</div> + +<p>通过<strong>列合并符</strong> (<code>||</code>)链接两个元素时, 它只会匹配被第二个CSS选择器匹配的元素,且此元素属于被第一个CSS选择器匹配的列元素.</p> + +<pre class="brush: css; no-line-numbers">/* 属于"被选择"列的表单元格 */ +col.selected || td { + background: gray; +} +</pre> + +<h2 id="语法">语法</h2> + +<pre><var>column-selector</var> || <var>cell-selector</var> { + <var>/* style properties */</var> +}</pre> + +<h2 id="示例">示例</h2> + +<h3 id="HTML">HTML</h3> + +<pre class="brush: html;"><table border="1"> + <colgroup> + <col span="2"/> + <col class="selected"/> + </colgroup> + <tbody> + <tr> + <td>A + <td>B + <td>C + </tr> + <tr> + <td colspan="2">D</td> + <td>E</td> + </tr> + <tr> + <td>F</td> + <td colspan="2">G</td> + </tr> + </tbody> +</table></pre> + +<h3 id="CSS">CSS</h3> + +<pre class="brush: css;">col.selected || td { + background: gray; + color: white; + font-weight: bold; +}</pre> + +<h3 id="结果">结果</h3> + +<p>{{EmbedLiveSample("Examples", "100%")}}</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("CSS4 Selectors", "#the-column-combinator", "column combinator")}}</td> + <td>{{Spec2("CSS4 Selectors")}}</td> + <td>最初的定义.</td> + </tr> + </tbody> +</table> + +<h2 id="浏览器兼容性">浏览器兼容性</h2> + +<div class="hidden">本页面的兼容性表格是从结构化的数据中产生的。如果你想要为这些数据作出贡献,请查看<a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a>,然后给我们一个拉取的请求。</div> + +<p>{{Compat("css.selectors.column")}}</p> + +<h2 id="相关">相关</h2> + +<ul> + <li>{{HTMLElement("col")}}</li> + <li>{{HTMLElement("colgroup")}}</li> + <li>{{CSSxRef("grid")}}</li> +</ul> |