위치:절대; 속성을 사용하면 가장 가까운 위치에 있는 조상을 기준으로 요소를 배치할 수 있습니다.
예시
다음 코드를 실행하여 CSS 위치를 구현할 수 있습니다. absolute;
<!DOCTYPE html>
<html>
<head>
<style>
div.one {
position: relative;
width: 500px;
height: 150px;
border: 2px solid blue;
}
div.two {
position: absolute;
top: 70px;
right: 0;
width: 300px;
height: 50px;
border: 2px solid yellow;
}
</style>
</head>
<body>
<h2>position: absolute;</h2>
The position: absolute; property allows you to position element relative to the nearest positioned ancestor.
<div class = "one">div has position: relative;
<div class = "two">div has position: absolute;</div>
</div>
</body>
</html>