
- 셀렉터 :
h1{} div{}- 전체 셀렉터 :
*{}- Tag 셀렉터 :
section, h1{}- ID 셀렉터 :
#only{}- Class 셀렉터 :
.widget{} .center{}- Attribute 셀렉터 :
a[href]{} p[id="only"] p[class~="out"]{} p[class|="out"]{} section[id^="sect"]{} div[class$="2"]{} div[class*="w"]{}- 후손 셀렉터 :
header h1{}- 자식 셀렉터 :
headeer > p{}- 인접 형제 셀렉터 :
section + p{}- 형제 셀렉터 :
section ~ p{}- 가상 클래스 :
a:link{} a:visited{} a:hover{} a:active{} a:focus{}- 요소 상태 셀렉터 :
input:checked + a{} input:enabled + a{} input:disabled + a{}- 구조 가상 클래스 셀렉터 :
p:first-child{} ul > li:last-child{} ul > li:nth-child(2n){} ul > li:nth-child(2n+1){} ul > li:first-child{} div > div:nth-child(4){} \n p:first-of-type{} div:last-of-type{} ul:nth-of-type(2){} p:nth-last-of-type(1){}- 부정 셀렉터 :
input:not([type="password"]){} div:not(:nth-of-type(2)){}- 정합성 확인 셀렉터 :
input[type="text"]:valid{} input[type="text"]:invalid{}
클래스에 w10, w20, h20, h40 등으로 지정하고 .w10 { width: 10%; } .h40 { height: 40%; } 같이 클래스 이름과 구현을 1:1 로 일치시켜 아주 작은 단위로 CSS를 작성하는 방법을 말한다.
때론 HTML 문서가 갖는 기본 스타일이 레이아웃을 구현하는데 방해가 된다. 그럴 땐 기본 스타일링을 제거하여 디자인한대로 구현할 수 있도록 의도하여 기본 스타일을 리셋한다.
예시 : * { box-sizing: border-box; } body { margin: 0; padding: 0; }
flexbox로 레이아웃을 구성한다는 것은, 박스를 유연하게 늘리거나 줄여 레이아웃을 잡는 방법이다.
display:flex;를 적용해 자식 박스의 방향과 크기를 결정flex-direction 속성으로 변경. row(기본값), columnflex: 0 1 auto; //기본값)justify-content 적용시 수평 정렬flex-start, flex-end, center, space-betweenalign-items 적용시 수직 정렬