CSS 清除float(浮动)属性----案例Windows系统logo

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

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

.c3{
width: 200px;
height: 200px;
/*clear:left左 right右 both左和右都*/
float: left;

clear: both;
}
.c4{
width: 200px;
height: 200px;
background-color: yellow;
float: left;
}

</style>
</head>
<body>

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

</body>
</html>

 

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