首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用带有内联块的column-width最少两行

使用带有内联块的column-width最少两行
EN

Stack Overflow用户
提问于 2018-08-15 08:13:54
回答 2查看 63关注 0票数 0

我正在尝试将内联块分成列,从每列中的一项开始。相反,它最初在一列中给了我两个块。我能做些什么来改变这种行为?

http://jsfiddle.net/fuqrwe64/10/

代码语言:javascript
复制
<style>
.container {
  background: #f99;
  column-width: 130px;
}

.item {
  background: #9f9;
  width: 130px;
  height: 40px;
  margin: 5px;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 2em;
  font-family: monospace;
}
</style>

<div class="container">
  <div class="item">A</div>
  <div class="item">B</div>
  <div class="item">C</div>
  <div class="item">D</div>
  <div class="item">E</div>
  <div class="item">G</div>
  <div class="item">H</div>
  <div class="item">I</div>
  <div class="item">F</div>
</div>
EN

回答 2

Stack Overflow用户

发布于 2018-08-15 08:18:19

使用column-count CSS属性

代码语言:javascript
复制
.item{
column-count:3;
}

如果要设置宽度,可以使用column-gap属性来设置宽度

票数 0
EN

Stack Overflow用户

发布于 2018-08-15 08:28:53

尝尝这个,

代码语言:javascript
复制
  .container {
  background: #f99;
  width:280px;
  display: flex;
  text-align: center;
  align-items: center;
  flex-wrap:wrap;
}

.item {
  background: #9f9;
  width: 130px;
  height: 220px;
  margin: 5px;
  justify-content: center;
  font-size: 2em;
}

我希望这是你想要的。如果不是,请让我知道确切的要求。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51851295

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档