aboutsummaryrefslogtreecommitdiff
path: root/files/ja/web/css/descendant_combinator/index.html
blob: b8fdf4239aa192ebad15d4a92068217218a93d47 (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
98
99
100
101
102
103
104
105
106
107
108
109
---
title: 子孫結合子
slug: Web/CSS/Descendant_combinator
tags:
  - CSS
  - Reference
  - Selector
  - Selectors
translation_of: Web/CSS/Descendant_combinator
---
<div>{{CSSRef("Selectors")}}</div>

<p><ruby><strong>子孫結合子</strong><rp> (</rp><rt>descendant combinator</rt><rp>)</rp></ruby> — 通常は単一の空白文字 (<code> </code>) で表される — は2つの CSS セレクターを結合し、1つ目のセレクターに一致する要素が祖先 (親、親の親、親の親の親、など) となっている2つ目のセレクターに一致します。子孫結合子を利用したセレクターは<dfn>子孫セレクター</dfn>と呼ばれます。</p>

<pre class="brush: css no-line-numbers notranslate">/* "my-things" リストの子孫のリスト項目 */
ul.my-things li {
  margin: 2em;
}</pre>

<p>子孫結合子は、技術的には他の結合子がない2つのセレクターの間にある1つ以上の {{Glossary("CSS")}} {{Glossary("Whitespace", "ホワイトスペース")}}文字 ― 空白文字や4種類の制御文字 (復帰、ページ送り、改行、タブ文字) のうちの1つ ― です。さらに、結合子としてのホワイトスペース文字には任意の数の CSS コメントを含めることができます。</p>

<h2 id="Syntax" name="Syntax">構文</h2>

<pre class="syntaxbox notranslate"><var>セレクター1</var> <var>セレクター2</var> {
  <var>/* プロパティ宣言 */</var>
}</pre>

<h2 id="Examples" name="Examples"></h2>

<h3 id="CSS">CSS</h3>

<pre class="brush: css notranslate">li {
  list-style-type: disc;
}

li li {
  list-style-type: circle;
}
</pre>

<h3 id="HTML">HTML</h3>

<pre class="brush: html notranslate">&lt;ul&gt;
  &lt;li&gt;
    &lt;div&gt;Item 1&lt;/div&gt;
    &lt;ul&gt;
      &lt;li&gt;Subitem A&lt;/li&gt;
      &lt;li&gt;Subitem B&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;div&gt;Item 2&lt;/div&gt;
    &lt;ul&gt;
      &lt;li&gt;Subitem A&lt;/li&gt;
      &lt;li&gt;Subitem B&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;
</pre>

<h3 id="Result" name="Result">結果</h3>

<p>{{EmbedLiveSample("Examples", "100%", 160)}}</p>

<h2 id="Specifications" name="Specifications">仕様書</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", "#descendant-combinators", "descendant combinator")}}</td>
   <td>{{Spec2("CSS4 Selectors")}}</td>
   <td></td>
  </tr>
  <tr>
   <td>{{SpecName("CSS3 Selectors", "#descendant-combinators", "descendant combinator")}}</td>
   <td>{{Spec2("CSS3 Selectors")}}</td>
   <td></td>
  </tr>
  <tr>
   <td>{{SpecName("CSS2.1", "selector.html#descendant-selectors", "descendant selectors")}}</td>
   <td>{{Spec2("CSS2.1")}}</td>
   <td></td>
  </tr>
  <tr>
   <td>{{SpecName("CSS1", "#contextual-selectors", "contextual selectors")}}</td>
   <td>{{Spec2("CSS1")}}</td>
   <td>初回定義</td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザーの互換性</h2>

<div class="hidden">このページの互換性一覧表は構造化データから生成されています。データに協力していただけるのであれば、 <a class="external" href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> をチェックアウトしてプルリクエストを送信してください。</div>

<p>{{Compat("css.selectors.descendant")}}</p>

<h2 id="See_also" name="See_also">関連情報</h2>

<ul>
 <li><a href="/ja/docs/Web/CSS/Child_combinator">子結合子</a></li>
</ul>