[英]Is there away to override flex-direction: row?
I have a container that uses flex-direction: row
and I would like to keep it that way the only problem is that now I want to put something under a div without having to nest it in.我有一个使用
flex-direction: row
的容器,我想保持这种方式,唯一的问题是现在我想把一些东西放在 div 下,而不必把它嵌套进去。
And I would like to do something like this:我想做这样的事情:
My main_continer css looks something like this:我的 main_continer css 看起来像这样:
main_container {
display: flex;
width: 100%;
height: 100%;
align-items: center;
justify-content: center;
flex-direction: row;
border: 1px solid #DDDDDD;
border-bottom: 1px solid #DDDDDD;
text-align: left;
.div_2 {
width: 90%;
}
Is it possible to override flex direction row some way?是否可以以某种方式覆盖 flex 方向行?
Add the ability for the flex items to wrap:添加 flex 项目的包装能力:
.main_container {
// ...rest of styles
flex-wrap: wrap;
}
Then override the order for that second item, making it come after the fourth item:然后覆盖第二项的顺序,使其在第四项之后:
.div_2 {
order: 4; // default is 0, you might need to play with this value
}
Last make sure the items layout 3 across, add some new class to all the items in the flex container so you can target them together:最后确保项目布局 3,向 flex 容器中的所有项目添加一些新类,以便您可以将它们定位在一起:
.new_class_on_all_items {
width: 33.333%;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.