我完全不知道如何将flex css应用于amp-list。我希望所有的子项在水平方向上均匀分布,并在项之间留出空格。
当我删除float:left时,从子项中,我得到的只是一列,而不是行。
看起来flex并不适用于孩子。
有可能做到这一点吗?如果你可以的话,我会很乐意帮忙的。
CSS:
.container-flex {
display:flex;
flex-flow:row wrap;
justify-content: space-around;
display:-webkit-box;display:-ms-flexbox;display:flex;
ms-flex-wrap:wrap;flex-wrap:wrap;
-webkit-box-pack:justify;-ms-flex-pack:justify;
justify-content:space-between
}
.item-flex {
float:left;
min-width:200px;
min-height:350px;
flex-basis:auto;
flex-grow:1
}
.mb2 { margin-bottom:2rem;}
.mx-auto{ margin-left:auto;margin-right:auto;}AMP-LIST:
<amp-list class="container-flex" [src]="json.src" src="json.src" height="2500" width="auto" layout="fixed-height">
<template type="amp-mustache">
<div class="item-flex left mb2 mx-auto">
...content...
</div>
</template>
</amp-list>发布于 2018-10-18 00:04:14
尝试更改您的json。在json资源中的一个组中收集flex项数据。示例:
{
"items":[
{
"flex-item-group":[
{ "your-data": "value" },
{ "your-data-2" : "value 2" }
]
}
]
}然后,在您的html上,应用以下内容:
<amp-list class="container-flex" [src]="json.src" src="json.src" height="2500" width="auto" layout="fixed-height">
<template type="amp-mustache">
<div class="item-flex left mb2 mx-auto">
{{#flex-item-group}}
...content...
{{/flex-item-group}}
</div>
</template>
发布于 2021-07-03 11:32:48
.container-flex > div它已应用内部
https://stackoverflow.com/questions/51143956
复制相似问题