--- title: 인접 형제 결합자 slug: Web/CSS/Adjacent_sibling_combinator tags: - CSS - Reference - Selectors translation_of: Web/CSS/Adjacent_sibling_combinator original_slug: Web/CSS/인접_형제_선택자 ---
인접 형제 결합자(+
)는 앞에서 지정한 요소의 바로 다음에 위치하는 형제 요소만 선택합니다.
/* Paragraphs that come immediately after any image */ img + p { font-weight: bold; }
former_element + target_element { style properties }
li:first-of-type + li { color: red; }
<ul> <li>One</li> <li>Two!</li> <li>Three</li> </ul>
{{EmbedLiveSample("예제", "100%", 100)}}
Specification | Status | Comment |
---|---|---|
{{SpecName('CSS4 Selectors', '#adjacent-sibling-combinators', 'next-sibling combinator')}} | {{Spec2('CSS4 Selectors')}} | |
{{SpecName('CSS3 Selectors', '#adjacent-sibling-combinators', 'Adjacent sibling combinator')}} | {{Spec2('CSS3 Selectors')}} | |
{{SpecName('CSS2.1', 'selector.html#adjacent-selectors', 'Adjacent sibling selectors')}} | {{Spec2('CSS2.1')}} | Initial definition |
{{Compat("css.selectors.adjacent_sibling")}}