blob: 0105c349dc1d7863a7e27e484acaed737d091bcc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
---
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>
<p>{{Compat("css.selectors.column")}}</p>
<h2 id="相关">相关</h2>
<ul>
<li>{{HTMLElement("col")}}</li>
<li>{{HTMLElement("colgroup")}}</li>
<li>{{CSSxRef("grid")}}</li>
</ul>
|