CSS Diner
A fun game to help you learn and practice CSS selectors.
flukeout.github.io
- #id


#fancy - A B(부모 자식)


plate apple(접시 위 사과) - #id A


#fancy pickle(fancy라는 접시 위 피클) - A.class


apple.small(클래스가 'small'인 사과)[apple]없이 [.small]도 가능 - 1~4 종합

bento orange.small(bento 위 'small'인 오렌지 
- A,B

bento, plate(bento, plate위의 모든것) 
- *(전부다)

* 
- A *(A의 모든것)

palte * 
- A + B(인접 형제 결합자)

plate + (plate 옆(바로다음)의 것) 
- A ~ B(일반 형제 결합자)

bento ~ pickle(bento 이후 나오는 pickle들) 
- A > B(직계 자손 선택)


plate > apple(plate 바로 위 apple) - :first-child

plate orange:first-child(plate 위 처음 등장하는 orange) - only Child

plate>:only-child(plate위의 단독적으로만 있는 자식들) 
- :last-child


*:last-chid.small - :nth-child(n)


*:nth-child(3) (3번쨰 자식) - :nth-last-child(n)


bento:nth-last-child(3) - :first-of-type

apple:first-of-type(처음으로 작성된 apple) 
- :nth-of-type(A)

:nth-of-type(even) (짝수번째 plate들) 
- :nth-of-type(An+B)

plate:nth-type-of(2n+3) 
- :only-of-type


apple:only-of-type - :last-of-type


orange:last-of-type, apple:last-of-type - :empty


bento:empty - :not(A)

apple:not(.small) 
- [attribute]


[for] - A[attribute]


plate[for] - [attribute="value"]


[for="Vitaly"] - [attribute$="value"]


[for$="to"] (attribute value값이 "str"로 끝나는 것) - [attribute*="value"]


[for*="to"] (attribute value값에 "str"가 포함된 것)
'웹' 카테고리의 다른 글
| 4일차 - Javascript 비동기처리 (0) | 2024.07.18 |
|---|---|
| 4일차 - JavaScript (0) | 2024.07.18 |
| 개발로드 2-3. 프론트앤드 기본 지식(JavaScript) (1) | 2024.05.28 |
| 개발로드 2-2. 프론트앤드 기본 지식(CSS) (1) | 2024.05.13 |
| 개발로드 2-1. 프론트앤드 기본 지식(HTML) (1) | 2024.05.12 |