CSS float(浮动)属性

知识点1:
1.当设置float属性时,它上一个有float属性会紧跟,反之(无float属性)会另起一行。

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
.c1{
width: 200px;
height: 200px;

}
.c2{
width: 200px;
height: 200px;
background-color: green;
/*left左 right右*/
float: left;
}

.c3{
width: 200px;
height: 200px;

float: left;
}

</style>
</head>
<body>

<div class="c1"></div>
<div class="c2"></div>
<div class="c3"></div>

</body>
</html>

 

posted @ 2022-05-28 20:10  呼长喜  阅读(38)  评论(0编辑  收藏  举报