그냥 문서 (:first-of-type
및 :first-child
)를 읽어
:first-child
는 부모의 첫 번째 자식 인 모든 요소를 선택합니다.
:first-of-type
동일한 요소 이름의 형제들 중 최초로 모든 요소를 선택한다.
:first-of-type
선택기 형제 세트 사이에 소정의 이름 (예컨대 span
, a
등)의 첫 번째 요소와 일치한다. 귀하의 예는 일치합니다 :
<li>
<span>Matches this span</span> <!-- First span amongst siblings -->
<a>Matches this a</span> <!-- First a amongst siblings -->
<a>Doesn't match this one</span> <!-- Second a amongst siblings -->
</li>
:first-child
선택은 단순히 경기 부모의 첫 번째 자식이됩니다
<li>
<span>Matches this span</span> <!-- First child of parent -->
<a>Doesn't match this</span> <!-- Second child of parent -->
<a>Nor this</span> <!-- Third child of parent -->
</li>
당신은 정말이 바로 문서를 읽어야합니다. – Archer
확인. 나는 설명서를 읽었지만 명확한 그림을 얻지 못했습니다. 그래서 나는 단지 여기에 게시한다. 지금 나는 약간의 예를 가지고있다. 그래서 나의 의심은 명백하다. –