웹 프로그래밍/css

position: relative, absolute, fixed, static

jsleee 2023. 8. 27. 10:34

position 속성은 요소를 배치하는 방법을 지정한다. 

1. relative: 

element가 '처음 생성된 위치'를 기준점으로, top bottom left right으로 위치를 조금씩 수정할 수 있다.

 

2. absolute:

가장 가까운 relative 부모를 기준으로 이동

 

3. fixed:

element가 처음 생성된 자리에 계속 고정됨 (ex. 메뉴바)

 

4.static: 

defalut 값