aboutsummaryrefslogtreecommitdiff
path: root/files/ja/web/css/column_combinator/index.md
blob: 9021e21302d97a49b9123a4bfb5cd79a1bc3d75a (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
---
title: 列結合子
slug: Web/CSS/Column_combinator
tags:
  - CSS
  - 実験的
  - リファレンス
  - セレクター
  - 表
browser-compat: css.selectors.column
translation_of: Web/CSS/Column_combinator
---
{{CSSRef("Selectors")}}{{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>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>
```

### 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")}}