CSS Diner
css 선택자를 활용하여 간단한 게임을 진행
답과 풀이.
총 32문제!
select
plate
select
bento
id select
,#fancy
Descendant Selector
(한 요소 안에 모든 자손)
plate apple
id select Descendant
plate#fancy pickle
Class Selector
.samll
A.ClassName
orange.small
A ClassName
bento orage.small
Comma Combinator
plate, bento
The Universal Selector
,*
Combine the Universal Selector
plate *
Adjacent Sibling Selector
(인접 선택자. A 뒤에 B)
plate + apple
General Sibling Selector
(형제 선택자, A부터 있는 B)
bento ~ pickle
Child Selector
(A에 속해있는 B)
plate > apple
First Child Pseudo-selector
(A뒤의 첫번째 B)
plate orange:first-child
Only Child Pseudo-selector
(A요소의 자손)
plate apple:only-child,
plate pickle:only-child
Last Child Pseudo-selector
(A요소를 갖는 마지막 자손)
#fancy apple,
pickle:last-child
Nth Child Pseudo-selector
(n번째 자식 요소)
plate:nth-child(3)
Nth Last Child Selector
(뒤에서 n번째 요소)
bento:nth-last-child(3)
First of Type Selector
(x 타입을 갖는 첫번째 요소)
apple:first-of-type
Nth of Type Selector
(n번째 타입 셀렉터 - 짝수)
plate:nth-of-type(2n)
...(even)
Nth-of-type Selector with Formula
(n번째 부터 + b)
plate:nth-of-type(2n+3)
(3번째부터 +2n)
Only of Type Selector
(특정 속성을 가진 요소)
plate apple:only-of-type
Last of Type Selector
(특정 속성을 가진 마지막 요소)
orange:last-of-type,
apple:last-of-type
Empty Selector
(빈요소)
bento:empty
Negation Pseudo-class
(해당 속성을 갖고 있지 않은 요소)
apple:not(.small)
속성 선택자
Attribute Selector
[for]
Attribute Selector
(A요소 중 속성을 갖고 있는 요소)
plate[for]
Attribute Value Selector
(A요소 중 특정 속성을 갖고 있는 요소)
bento[for='Vitaly']
Attribute Starts With Selector
(A요소 중 특정 문자로 시작하는 요소)
[for^='Sa']
Attribute Ends With Selector
(A요소 중 특정 문자로 끝나는 요소)
[for$="to"]
Attribute Wildcard Selector
(A요소 중 특정 문자를 갖고 있는 요소)
bento[for*="bb"]