老师我的红框总是偏右一点,麻烦看一下
来源:2-5 position-relative
qq_慕先生2229342
2020-04-16 15:50:29
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>position-relative</title>
<style>
*{
margin: 0px;
padding: 0px;
}
.block{
position: relative;
top: 0px;
left: 0px;
width: 80px;
height: 80px;
line-height: 80px;
border: 2px solid black;
text-align: center;
float: left;
}
.block:nth-child(2){
position: relative;
top: 0px;
left: -80px;
border: red 2px solid;
}
</style>
</head>
<body>
<div class="block">A</div>
<div class="block">B</div>
</body>
</html>
1回答
相似问题