/
index.md
81 lines (63 loc) · 1.25 KB
/
index.md
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
---
title: 列結合子
slug: Web/CSS/Column_combinator
---
{{CSSRef}} {{SeeCompatTable}}
**列結合子** (column combinator, `||`) は、2 つの CSS セレクターの間に配置されます。前者のセレクターに一致する列要素に所属する、後者のセレクターに一致する要素に一致します。
```css
/* 表の "selected" クラスの列に所属するセル */
col.selected||td {
background: gray;
}
```
## 構文
```css
column-selector||cell-selector {
/* スタイルプロパティ */
}
```
## 例
### HTML
```html
<table border="1">
<colgroup>
<col span="2" />
<col class="selected" />
</colgroup>
<tbody>
<tr>
<td>A</td>
<td>B</td>
<td>C</td>
</tr>
<tr>
<td colspan="2">D</td>
<td>E</td>
</tr>
<tr>
<td>F</td>
<td colspan="2">G</td>
</tr>
</tbody>
</table>
```
### CSS
```css
col.selected||td {
background: gray;
color: white;
font-weight: bold;
}
```
### 結果
{{EmbedLiveSample("Examples", "100%")}}
## 仕様書
{{Specifications}}
## ブラウザーの互換性
{{Compat}}
## 関連情報
- {{HTMLElement("col")}}
- {{HTMLElement("colgroup")}}
- {{CSSxRef("grid")}}
- {{CSSxRef(":nth-col")}}
- {{CSSxRef(":nth-last-col")}}