--- title: 隣接兄弟結合子 slug: Web/CSS/Adjacent_sibling_combinator tags: - CSS - Reference - Selectors - セレクター translation_of: Web/CSS/Adjacent_sibling_combinator --- <div>{{CSSRef("Selectors")}}</div> <p><ruby><strong>隣接兄弟結合子</strong><rp> (</rp><rt>adjacent sibling combinator</rt><rp>)</rp></ruby> (<code>+</code>) は2つのセレクターを接続し、同じ親{{DOMxRef("element", "要素")}}の子同士であって、1つ目の要素の<em>直後</em>にある2つ目の要素を選択します。</p> <pre class="brush: css no-line-numbers">/* 画像の直後に来る段落 */ img + p { font-style: bold; }</pre> <h2 id="Syntax" name="Syntax">構文</h2> <pre class="syntaxbox">直前の要素 + 対象の要素 { <em>スタイルプロパティ</em> } </pre> <h2 id="Example" name="Example">例</h2> <h3 id="CSS">CSS</h3> <pre class="brush: css">li:first-of-type + li { color: red; } </pre> <h3 id="HTML">HTML</h3> <pre class="brush: html"><ul> <li>One</li> <li>Two!</li> <li>Three</li> </ul></pre> <h3 id="Result">Result</h3> <p>{{EmbedLiveSample("Example", "100%", 100)}}</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", "#adjacent-sibling-combinators", "next-sibling combinator")}}</td> <td>{{Spec2("CSS4 Selectors")}}</td> <td>名前を「次の兄弟」結合子に変更。</td> </tr> <tr> <td>{{SpecName("CSS3 Selectors", "#adjacent-sibling-combinators", "Adjacent sibling combinator")}}</td> <td>{{Spec2("CSS3 Selectors")}}</td> <td> </td> </tr> <tr> <td>{{SpecName("CSS2.1", "selector.html#adjacent-selectors", "Adjacent sibling selectors")}}</td> <td>{{Spec2("CSS2.1")}}</td> <td>初回定義</td> </tr> </tbody> </table> <h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザーの対応</h2> <p>{{Compat("css.selectors.adjacent_sibling")}}</p> <h2 id="See_also" name="See_also">関連情報</h2> <ul> <li><a href="/ja/docs/Web/CSS/General_sibling_combinator">一般兄弟結合子</a></li> </ul>