简体   繁体   English

flex-direction行不表现为行

[英]flex-direction row not behaving as row

I have a flexbox grid that I'm using for some cards, however the cards when given the css property of flex-direction: row; 我有一个用于某些卡片的flexbox网格,但是当卡片具有flex-direction: row;的css属性时flex-direction: row; will not actually behave as a row, but instead, will behave as column. 实际上不会表现为行,而是表现为列。 I tried marking it as !important, however, it still will not behave as row. 我尝试将其标记为!important,但是,它仍然不会像row那样运行。 I would like each element to fit decently before going to a second line. 在第二行之前,我希望每个元素都合适。

I've read this article many times trying to find out why it isn't behaving like I want to, but I haven't been able to hit the deal. 我已经多次阅读这篇文章 ,试图找出为什么它的表现不如我想要的那样,但是我还是无法达成协议。 Any idea why this is happening? 知道为什么会这样吗?

Here's a fiddle: https://jsfiddle.net/yisera/qtv5h5eb/ 这是一个小提琴: https : //jsfiddle.net/yisera/qtv5h5eb/

Your elements are behaving as a row. 你的元素表现为一个排。 Each item is just so wide that it's wrapping around ( flex-wrap ), and you're getting what looks like a column. 每个项目的宽度是如此之大,以至于它们都被包裹起来了( flex-wrap ),您将获得看起来像一列的东西。

Reducing the width of the .wall-panel s puts them back in a row-like formation. 减小.wall-panel的宽度会使它们重新.wall-panel行状。

https://jsfiddle.net/Hatchet/qtv5h5eb/2/ https://jsfiddle.net/Hatchet/qtv5h5eb/2/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM