<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>浮动</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
.parent {
margin: 0 auto;
width: 600px;
height: 400px;
}
.childFir {
float: left;
width: 140px;
height: 400px;
background-color: skyblue;
}
.childSec {
float: right;
width: 460px;
height: 400px;
background-color: green;
}
li {
float: left;
width: 149px;
height: 194px;
list-style: none;
margin-right: 6px;
margin-bottom: 6px;
background-color: greenyellow;
}
li:nth-child(3n) {
margin-right: 0;
}
</style>
</head>
<body>
<div class="parent">
<div class="childFir"></div>
<div class="childSec">
<ul>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</div>
</div>
</body>
</html>
CSS浮动(float)
于 2025-08-06 15:12:39 首次发布
547

被折叠的 条评论
为什么被折叠?



