Python_WEB/HTML
[Ch6]CSS3 레이아웃과 애니메이션 연습문제 4
AnKiWoong
2020. 12. 2. 21:08
반응형
Q>
상대 위치 설정(relative positioning)을 이용해 다음과 같은 <div> 블록을 표시해 보자.
A>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
div {
display: table;
text-align: center;
vertical-align: middle;
margin: 20px;
}
#one {
position: relative;
display: table-cell;
background-color: hotpink;
left: 0px;
top: 0px;
width: 200px;
height: 200px;
border: 1px solid black;
box-sizing: border-box;
}
#two {
position: relative;
display: table-cell;
background-color: lightcoral;
right: 0px;
top: 0px;
width: 200px;
height: 200px;
border: 1px solid black;
box-sizing: border-box;
}
#three {
position: relative;
display: table-cell;
background-color: lightseagreen;
left: -400px;
bottom: -200px;
width: 200px;
height: 200px;
border: 1px solid black;
box-sizing: border-box;
}
#four {
position: relative;
display: table-cell;
background-color: lightgray;
right: 400px;
bottom: -200px;
width: 200px;
height: 200px;
border: 1px solid black;
box-sizing: border-box;
}
</style>
</head>
<body>
<div>
<div id="one">left:0;top:0</div>
<div id="two">right:0;top:0</div>
<div id="three">left:0;bottom:0</div>
<div id="four">right:0;bottom:0</div>
</div>
</body>
</html>
R>
![]() |
|
반응형