diff options
Diffstat (limited to 'files/ko/web/css/_colon_first-child/index.html')
-rw-r--r-- | files/ko/web/css/_colon_first-child/index.html | 134 |
1 files changed, 134 insertions, 0 deletions
diff --git a/files/ko/web/css/_colon_first-child/index.html b/files/ko/web/css/_colon_first-child/index.html new file mode 100644 index 0000000000..9d229f4dd5 --- /dev/null +++ b/files/ko/web/css/_colon_first-child/index.html @@ -0,0 +1,134 @@ +--- +title: ':first-child' +slug: 'Web/CSS/:first-child' +tags: + - CSS + - Layout + - Pseudo-class + - Reference + - Web +translation_of: 'Web/CSS/:first-child' +--- +<div>{{CSSRef}}</div> + +<p><a href="/ko/docs/Web/CSS">CSS</a> <strong><code>:first-child</code></strong> <a href="/ko/docs/Web/CSS/Pseudo-classes">의사 클래스</a>는 형제 요소 중 제일 첫 요소를 나타냅니다.</p> + +<pre class="brush: css no-line-numbers notranslate">/* Selects any <p> that is the first element + among its siblings */ +p:first-child { + color: lime; +}</pre> + +<div class="note"> +<p><strong>참고</strong>: 초기 정의에서는 부모가 있는 요소만 선택할 수 있었습니다. Selectors Level 4부터는 이 제한이 사라졌습니다.</p> +</div> + +<h2 id="구문">구문</h2> + +<pre class="syntaxbox notranslate">{{csssyntax}} +</pre> + +<h2 id="예제">예제</h2> + +<h3 id="기본_예제">기본 예제</h3> + +<h4 id="HTML">HTML</h4> + +<pre class="brush: html notranslate"><div> + <p>This text is selected!</p> + <p>This text isn't selected.</p> +</div> + +<div> + <h2>This text isn't selected: it's not a `p`.</h2> + <p>This text isn't selected.</p> +</div> +</pre> + +<h4 id="CSS">CSS</h4> + +<pre class="brush: css notranslate">p:first-child { + color: lime; + background-color: black; + padding: 5px; +} +</pre> + +<h4 id="결과">결과</h4> + +<p><span>{{EmbedLiveSample('기본_예제', 500, 200)}}</span></p> + +<h3 id="목록_스타일링">목록 스타일링</h3> + +<h4 id="HTML_2">HTML</h4> + +<pre class="brush: html notranslate"><ul> + <li>Item 1</li> + <li>Item 2</li> + <li>Item 3 + <ul> + <li>Item 3.1</li> + <li>Item 3.2</li> + <li>Item 3.3</li> + </ul> + </li> +</ul></pre> + +<h4 id="CSS_2">CSS</h4> + +<pre class="brush: css notranslate">ul li { + color: blue; +} + +ul li:first-child { + color: red; + font-weight: bold; +}</pre> + +<h4 id="결과_2">결과</h4> + +<p>{{EmbedLiveSample('목록_스타일링')}}</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', '#first-child-pseudo', ':first-child')}}</td> + <td>{{Spec2('CSS4 Selectors')}}</td> + <td>Matching elements are not required to have a parent.</td> + </tr> + <tr> + <td>{{SpecName('CSS3 Selectors', '#first-child-pseudo', ':first-child')}}</td> + <td>{{Spec2('CSS3 Selectors')}}</td> + <td>No change.</td> + </tr> + <tr> + <td>{{SpecName('CSS2.1', 'selector.html#first-child', ':first-child')}}</td> + <td>{{Spec2('CSS2.1')}}</td> + <td>Initial definition.</td> + </tr> + </tbody> +</table> + +<h2 id="브라우저_호환성">브라우저 호환성</h2> + + + +<p>{{Compat("css.selectors.first-child")}}</p> + +<h2 id="같이_보기">같이 보기</h2> + +<ul> + <li>{{CSSxRef(":-moz-first-node")}} {{Non-standard_Inline}}</li> + <li>{{CSSxRef(":first-of-type")}}</li> + <li>{{CSSxRef(":last-child")}}</li> + <li>{{CSSxRef(":nth-child", ":nth-child()")}}</li> +</ul> |