
top, bottom, left, right 사용inset 사용양수 = 안쪽음수 = 바깥쪽기본값(static)으로 되어 있으면 그걸 기준으로 안함🔥 relative vs absolute
relative : 원래 배치에서 자리 차지
absolute : 원래 배치에서 자리 차지하지 않음
display: block이면 left, right 값 필요 없음🔥 sticky 특별한점

green 값을 9999를 줘도 적용이 되지 않는 이유는 바로 클래스 부모(.red)가 이미 z-index: 1이기 때문에 그 값이 적용되는 것display: flex;
display: flex;
flex-direction: row; # 가로
flex-direction: column; # 세로
기본 축 (Main Axis) : 요소가 배치되는 방향교차 축 (Cross Axis) : 기본 축의 수직이 되는 방향🔥 기본축은 요소를 꽉 채운다.
display: flex;
justify-content: center;
display: flex;
align-items: center;
교차축 방향으로 넘어가서 배치됨display: flex;
flex-wrap: wrap;
display: flex;
gpa: 30px 50px; # 세로, 가로
flex-grow: 1;
flex-grow: 2;
0으로 설정하면, 원래 너비로 고정flex-shrink: 1;
flex-shrink: 2;
auto🔥 flex-basis 좋은점
flex-grow: 1;
flex-shrink: 0;
width: 300px;
flex-grow: 1;
flex-shrink: 0;
flex-basis: 300px;
flex: 1 0 300px;
3개 모두 같은 속성이다.
🔥 relative , sticky는 요소의 원래 자리를 차지하기 때문에 flexbox 영향 받음
🔥 absolute, fixed는 원래 자리에서 빠지기 때문에, flexbox 영향 받지 않음
display: grid
grid-template-columns: 100px 200px 100px;
display: grid
grid-template-rows: 100px 200px 100px;
🔥 grid-template : 하나로만 사용 가능하다
grid-template-columns: 100px 200px 100px / 100px 200px 100px;
width: 100%; # width 퍼센트일 때 동작
display: grid;
grid-template:
1fr 1fr 1fr/
1fr 1fr 1fr;
width: 100%; # width 퍼센트일 때 동작
display: grid;
grid-template:
1fr 1fr 1fr/
minmax(200px, 200px) minmax(200px, 200px) minmax(200px, 200px)
# 최소 최대 크기
# 이때 최대 크기만 fr단위 사용 가능
width: 100%;
display: grid;
grid-template:
repeat(3, 1fr)/
repeat(3, minmax(200px, 200px));
repeat(반복횟수, 속성값);
width: 100%;
display: grid;
grid-template:
repeat(3, 1fr)/
repeat(3, minmax(200px, 200px));
gap: 20px 40px;
gap: 세로 가로;
grid-auto-rows로 정해놓은 크기로 사용width: 100%;
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-auto-rows: 50px;
gap: 20px 40px;

width: 100%;
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-auto-rows: 50px 100px 200px;
gap: 20px 40px;

grid-row: 3
grid-column: 2
grid-row: 3 / 5 # 3번 row ~ 5번 row
grid-column: 2 / -2 # 2번 column ~ -2번 column
숫자 = 인덱스 번호
grid-area: r;
...
grid-area: b;
...
grid-area: g;
grid-template-areas:
"r g"
"r b"; # 칸을 비우고 싶을땐, . 사용

사진 출처 : 코드잇