--- title: 일반 형제 결합자 slug: Web/CSS/General_sibling_combinator tags: - CSS - Reference - Selectors translation_of: Web/CSS/General_sibling_combinator --- <div>{{CSSRef("Selectors")}}</div> <p><strong>일반 형제 결합자</strong>(<code>~</code>)는 두 개의 선택자 사이에 위치하여 뒤쪽 선택자의 요소와 앞쪽 선택자 요소의 부모 요소가 같고, 뒤쪽 선택자의 요소가 뒤에 위치할 때 선택합니다. 두 요소가 서로 붙어있을 필요는 없습니다.</p> <pre class="brush: css no-line-numbers">/* 서로 형제인 문단 중 이미지 뒤쪽인 경우에만 선택 */ img ~ p { color: red; }</pre> <h2 id="구문">구문</h2> <pre class="syntaxbox">former_element ~ target_element { <em>style properties</em> } </pre> <h2 id="예제">예제</h2> <h3 id="CSS">CSS</h3> <pre class="brush: css">p ~ span { color: red; }</pre> <h3 id="HTML">HTML</h3> <pre class="brush: html"><span>이건 빨강이 아닙니다.</span> <p>여기 문단이 있습니다.</p> <code>그리고 코드도 있습니다.</code> <span>이제 빨강입니다!</span> <code>더 많은 코드가 있습니다.</code> <span>이것도 빨강입니다!</span> </pre> <h3 id="결과">결과</h3> <p>{{EmbedLiveSample("예제", "100%", 120)}}</p> <h2 id="명세">명세</h2> <table class="standard-table"> <thead> <tr> <th scope="col">Specification</th> <th scope="col">Status</th> <th scope="col">Comment</th> </tr> </thead> <tbody> <tr> <td>{{SpecName("CSS4 Selectors", "#general-sibling-combinators", "subsequent-sibling combinator")}}</td> <td>{{Spec2("CSS4 Selectors")}}</td> <td>Renames it the "subsequent-sibling" combinator.</td> </tr> <tr> <td>{{SpecName("CSS3 Selectors", "#general-sibling-combinators", "general sibling combinator")}}</td> <td>{{Spec2("CSS3 Selectors")}}</td> <td>Initial definition.</td> </tr> </tbody> </table> <h2 id="브라우저_호환성">브라우저 호환성</h2> <p>{{Compat("css.selectors.general_sibling")}}</p> <h2 id="같이_보기">같이 보기</h2> <ul> <li><a href="/ko/docs/Web/CSS/인접_형제_선택자">인접 형제 결합자</a></li> </ul>