position(relative)

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>position_relative</title>
<style>

.div1{
background-color: #2eb1fc;
width:100px;
height:100px;
}
.div2{
background-color:#1ecc86;
width:100px;
height:100px;
position:relative;
left:100px;/*相对原来位置右移100*/
top:100px;/*相对原来位置下移100*/
}
.div3{
background-color:#71a403;
width:200px;
height:200px;
}
</style>
</head>
<body>
<div class="div1">111</div>
<div class="div2">222</div>
<div class="div3">333</div>
</body>
</html>

猜你喜欢

转载自www.cnblogs.com/startl/p/12177951.html