是否有替代flex-direction:row的方法?

时间:2019-03-13 22:27:30

标签: html css css3 flexbox flex-direction

我有一个使用memory.Span的容器,我想保持这种方式唯一的问题是,现在我想将某些东西放在div下而不必将其嵌套。

这就是我所拥有的。 enter image description here

我想做这样的事情: enter image description here

我的main_continer CSS看起来像这样:

flex-direction: row

是否可以以某种方式覆盖flex方向行?

1 个答案:

答案 0 :(得分:0)

添加用于包装弹性商品的功能:

.main_container {
  // ...rest of styles
  flex-wrap: wrap;
}

然后覆盖第二项的顺序,使其排在第四项之后:

.div_2 {
  order: 4; // default is 0, you might need to play with this value
}

最后确保项目布局为3,向flex容器中的所有项目添加一些新类,以便可以将它们一起定位:

.new_class_on_all_items {
  width: 33.333%;
}
相关问题