html - 如何在css中将一个div分成多行和多列?

标签 html css css-float

我在 maindiv 中有一个 div subdiv。我想将子 div 分成多行和多列,如下所示。

如何划分subdiv如下

enter image description here

最佳答案

你可以这样做

div{
  display:inline-block;
  float:left;
  color:#fff;
  font-size:40px;
}

.one{
  width:150px;
  height:200px;
  background:red;
}

.two{
    width:100px;
  height:200px;
  background:lightgreen;
}

.three{
    width:100px;
  height:200px;
}

.four{
  width:100px;
  height:100px;
background:darkblue;
}
.five{
  width:100px;
  height:100px;
background:blue;
}
<div class="one">1</div>
<div class="two">2</div>
<div class="three">
  <div class="four">4</div>
  <div class="five">5</div>
</div>

关于html - 如何在css中将一个div分成多行和多列?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29427834/

相关文章:

jquery - HTML 'moving link over' div 跨度,nbsp

javascript - 如何多次调用一个动画函数

css - 如何使相对于另一个div的固定位置div?

css - 在 Chrome 中悬停时显示隐藏的嵌套跨度时列表项高度的奇怪跳跃

css - 尝试使用@each 函数编译 map 的 CSS 时出现 Sass 错误

html - 我怎样才能将我的图像设置在右边?

javascript - If Else 用于按下按钮时的 javascript

javascript - 忽略对 jquery.change 的关注

javascript - 在 contenteditable 元素上制作 div 按钮

html - CSS 优先级在 bootstrap 中无法按预期工作