把一个div分为十个不同大小的部分,每个部分填充不一样的内容
时间: 2024-03-23 21:35:57 浏览: 16
好的,我可以为您提供一个简单的HTML和CSS代码示例,实现将一个div分为十个不同大小的部分,并填充不同的内容。请注意,以下示例仅供参考,您可以根据自己的需求进行修改。
HTML代码:
```html
<div class="container">
<div class="box1"></div>
<div class="box2"></div>
<div class="box3"></div>
<div class="box4"></div>
<div class="box5"></div>
<div class="box6"></div>
<div class="box7"></div>
<div class="box8"></div>
<div class="box9"></div>
<div class="box10"></div>
</div>
```
CSS代码:
```css
.container {
width: 500px;
height: 500px;
display: flex;
flex-wrap: wrap;
}
.box1 {
width: 100px;
height: 100px;
background-color: #F44336;
}
.box2 {
width: 120px;
height: 80px;
background-color: #E91E63;
}
.box3 {
width: 80px;
height: 120px;
background-color: #9C27B0;
}
.box4 {
width: 150px;
height: 50px;
background-color: #673AB7;
}
.box5 {
width: 50px;
height: 150px;
background-color: #3F51B5;
}
.box6 {
width: 110px;
height: 90px;
background-color: #2196F3;
}
.box7 {
width: 90px;
height: 110px;
background-color: #00BCD4;
}
.box8 {
width: 70px;
height: 130px;
background-color: #4CAF50;
}
.box9 {
width: 130px;
height: 70px;
background-color: #FFC107;
}
.box10 {
width: 120px;
height: 80px;
background-color: #795548;
}
```
在上面的示例中,我们将一个div分为十个不同大小的部分,每个部分填充不同颜色的背景。您可以使用这个示例作为参考,并根据您的需要进行修改,以填充不同的内容。