HTML 화면상의 Layout을 결정하는 CSS요소는 다음과 같다.
이번에는 Position 속성의 종류와 특징에 대해 알아보려 한다.
Position은 각각의 element들이 화면상에 어디에 위치하게 되는지 화면상의 Layout을 결정한다.
각각의 종류를 살펴보면
div.static {
position: static; //default
border: 3px solid #73AD21;
}
div.relative {
position: relative;
left: 30px;
border: 3px solid #73AD21;
}
div.relative {
position: relative;
width: 400px;
height: 200px;
border: 3px solid #73AD21;
}
div.absolute {
position: absolute;
top: 80px;
right: 0;
width: 200px;
height: 100px;
border: 3px solid #73AD21;
}
div.fixed {
position: fixed;
bottom: 0;
right: 0;
width: 300px;
border: 3px solid #73AD21;
}
div.sticky {
position: sticky;
top: 0;
padding: 5px;
background-color: #cae8ca;
border: 2px solid #4CAF50;
}
https://www.w3schools.com/css/css_positioning.asp
https://coding-yesung.tistory.com/100