我想创建以下方案中解释的行为:
每当一个元素在屏幕之外时,我希望它被放置在一个新的列中,在右边。
目前,所有元素都在同一列中。
这是我的元素当前的显示方式:
<style is="custom-style" include="iron-flex">
.flex-wrap {
@apply(--layout-wrap);
@apply(--layout-vertical);
}
</style>
<template>
<div class="container flex-wrap" >
<template is="dom-repeat" items="{{employeesArray}}">
<employee-element name="{{item.title}}"
preview="{{item.preview}}"
width={{item.width}} height={{item.height}}>
</employee-element>
</template>
</div>
</template>
如何强制元素放置在我绘制的位置?
最佳答案
这可以通过大多数较新的浏览器支持的列属性来完成:
.container {
height: 100px;
border: 1px solid black;
column-fill: auto;
-webkit-column-fill: auto;
-moz-column-fill: auto;
column-width: 150px;
-webkit-column-width: 150px;
-moz-column-width: 150px;
}
HTML:
<div class="container">
<div>employee #1</div>
<div>employee #2</div>
....
<div>employee #x</div>
</div>
关于css - 溢出时如何发送 "right"上的元素?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36823490/