简体   繁体   English

CSS 中的 Flex 方向属性

[英]Flex-direction property in CSS

I'm trying to modify the code at我正在尝试修改代码

https://codepen.io/rperry1886/pen/KKwbQNP https://codepen.io/rperry1886/pen/KKwbQNP

to have the images display left-to-right rather than vertically.让图像从左到右显示,而不是垂直显示。 I've tried reading up on Flexbox, ie, https://css-tricks.com/snippets/css/a-guide-to-flexbox/ , which seems to suggest that changing我试过阅读 Flexbox,即https://css-tricks.com/snippets/css/a-guide-to-flexbox/ ,这似乎表明改变

flex-direction: column;

to

flex-direction: row;

should do the trick;应该做的伎俩; but that seems to have no effect on the code above.但这似乎对上面的代码没有影响。 Can anyone explain why that is, and how I'd go about trying to have items display left-to-right here?谁能解释为什么会这样,以及我将如何尝试让项目从左到右显示?

Just set display:flex;只需设置 display:flex; and flex-direction:row;和 flex-direction:row; to the grid-container, NOT the body.到网格容器,而不是身体。 If it doesn't work, add .grid-container {display:flex;如果它不起作用,请添加 .grid-container {display:flex; flex-direction:row;} at the very bottom after every bracket. flex-direction:row;} 在每个括号后的最底部。

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

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