[英]Box positioning with/without flex
I saved the code here : http://codepen.io/anon/pen/FxKHB Maybe it's better for you to see it and try something to help me. 我将代码保存在这里: http : //codepen.io/anon/pen/FxKHB也许对您来说更好看一下并尝试一些对我有所帮助的代码。
My problem is that I have to position the box with 'Dessert' just under the box with 'Entrée' : without the space between. 我的问题是我必须将“ Dessert”框放置在“Entrée”框下方:之间没有空格。
I use flexbox layout in my container : 我在容器中使用flexbox布局:
.menuContainer
{
display:flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: space-between;
align-content: flex-start;
align-items: flex-start;
}
Problem : the box 'Dessert' is pushed under because there is too much lines in the box 'Plat'. 问题:由于框“ Plat”中的行过多,因此将“ Dessert”框下移。
Maybe I chose the wrong layout. 也许我选择了错误的布局。 I chose this one because when the width of the window/device is too small, I need to get everything in one column.
我之所以选择这一行,是因为当窗口/设备的宽度太小时,我需要将所有内容都放在一列中。 I can not just change the relative position of my box because each content is not static.
我不能只更改框的相对位置,因为每个内容都不是静态的。 I mean, it can have more lines.
我的意思是,它可以有更多行。
What should I do ? 我该怎么办 ? Is it even possible ?
可能吗?
Thank you for your help ! 谢谢您的帮助 !
An elegant alternative would be to change your align-items
property to stretch
for you container and then vertically center the items by making them flexboxes. 一个不错的选择是更改
align-items
属性以为您的容器stretch
,然后通过使它们成为弹性框来使它们垂直居中。
I guess it is not quite the desired effect, but without changing the markup this is the best solution I could come up with. 我想这不是理想的效果,但是如果不更改标记,这是我能想到的最佳解决方案。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.