Reputation: 41
I'm totally at a loss as to how to apply the flex css to amp-list. I'd like all child items to be evenly spaced in the horizontal with spaces between the items.
When I remove float:left; from the child item, all I get is a column, not rows.
It seems that flex is not applied to the children.
Is it possible to do this? If you can, I'd love the help.
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>
Upvotes: 2
Views: 1241
Reputation: 1
.container-flex > div
its applied for inner <div role="list" as parent for item-flex
Upvotes: 0
Reputation: 73
Try to change your json. Collect your flex item data in one group in your json resource. Example:
{
"items":[
{
"flex-item-group":[
{ "your-data": "value" },
{ "your-data-2" : "value 2" }
]
}
]
}
Then on your html, apply this:
<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>
Upvotes: 0