* {
box-sizing: border-box;
}
* = 모든 요소
따로 width를 선언하지 않은 경우, width = 부모의 content-box의 100%
따로 width를 선언한 경우, 남은 공간은 margin으로 자동으로 채움
따로 부모의 height를 선언하지 않을 경우, 자식 요소의 height의 합 = 부모의 height
margin: 0 auto;
Block(면) vs Inline(선)
면(영역) vs 선(흐름)
inline에서는 padding margin top bottom 사용 불가능
(Inline/Inline Block/Block) → Block
overflow:hidden;
Clearfix
Clear : left | right | both
Pseudo - Element
.pseudo::before {
content: ""
margin-rightL: 20px;
font-size: 30px;
}
clearfix::after {
content: '';
display: block;
clear: both;
}
#prev,
#next {
position: absolute;
top: 50%;
transform: translateY(-50%);
}
가운데 배치, position: absolute; 후 50% > transform: translate(X or Y)(-50%);
.flexbox {
display: flex;
/* flex | inline-flex */
.flexbox {
flex-direaction: row;
/* row | row-reverse | column | column-reverse */
row -> 왼->오른쪽 가로
column -> 위->아래 세로
.flexbox {
flex-wrap: nowrap;
/* nowrap | wrap */
Main axis → justify-content
justify-content : flex-start | flex-end | center | space-between | space-around;
Cross axis → align-items | align-content
center |
.red {
order:1;
.yellow {
order:2;
.blue {
order:3;
HTML → viewport meta
<meta name="viewport" content="width=device-width">
@media screen and (min-width: 768px) {
/* where all the magic happens ... */
}
CSS → media query
vh = viewport height
img 사이즈 조절 할 때는 display block; 필요
가운데 정렬 할 때는 반드시 자식요소를 감싸고있는 부모 요소한테!
미디어 쿼리 작업은 모바일 부터!