[英]Why is my display:inline-block; property displaying in top-to-bottom and not left-to-right?
I am creating a dynamic layout of divs that use display:inline-block, to help fit the content, since it could be different heights. 我正在创建一个使用display:inline-block的div的动态布局,以帮助适应内容,因为它的高度可能不同。
Here is the code I am using, but for some reason, my divs display like 这是我正在使用的代码,但是由于某种原因,我的div显示为
1357
2468
Rather than 而不是
1234
5678
Code I am using: 我正在使用的代码:
article{
-moz-column-width: 13em;
-webkit-column-width: 13em;
-moz-column-gap: 1em;
-webkit-column-gap: 1em;
}
section{
display: inline-block;
margin: 0.25rem;
padding: 1rem;
width: 100%;
background: #efefef;
}
It's because of the column
CSS property, who display elements in "columns" from top to bottom. 这是由于CSS属性
column
,该属性从上到下在“列”中显示元素。
To get a horizontal behavior, you can use display: inline-block
or use JS plugin such as masonry. 要获得水平行为,可以使用
display: inline-block
或使用JS插件(如砌体)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.