level 1
WJZSYRHGQ
楼主
给B设置float:left;但是浮动后的元素为什么块上去了而元素不随着块上去?
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>relative复习2</title>
<style type="text/css">
div{
width:80px;height:80px;
text-align:center;
line-height: 80px;
border:1px solid red;
}
.A{
border:1px solid green;
/*background:blue;*/
float:right;/*position:relative;left:50px;*/
}
.B{
border:1px solid black;
float:left;/*background: orange;*/
}
.C{
border:1px solid black;
/*float:left;*/background:green ;
}
.D{
border:1px solid black;
/*float:left;*/background:purple ;
}
</style>
</head>
<body>
<div class="A">A</div>
<div class="B">B</div>
<div class="C">C</div>
<div class="D">D</div>
</body>
</html>
2019年04月14日 02点04分
1
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>relative复习2</title>
<style type="text/css">
div{
width:80px;height:80px;
text-align:center;
line-height: 80px;
border:1px solid red;
}
.A{
border:1px solid green;
/*background:blue;*/
float:right;/*position:relative;left:50px;*/
}
.B{
border:1px solid black;
float:left;/*background: orange;*/
}
.C{
border:1px solid black;
/*float:left;*/background:green ;
}
.D{
border:1px solid black;
/*float:left;*/background:purple ;
}
</style>
</head>
<body>
<div class="A">A</div>
<div class="B">B</div>
<div class="C">C</div>
<div class="D">D</div>
</body>
</html>