Issue
Hi I am building a catalog app and I am showing some items but they are displaying at different sizes and I can-t achieve to get ion-cards to be displayed at same sizes
<ion-content [fullscreen]="true">
<ion-grid >
<ion-row *ngFor = 'let item of items'>
<ion-card>
<ion-img [src]='item.imagePath'></ion-img>
<ion-header>
<ion-card-title class='ion-text-center'> {{ item?.title }} </ion-card-title>
<ion-card-subtitle class='ion-text-center'> {{ item?.price }} </ion-card-subtitle>
</ion-header>
<!-- <ion-card-content class='ion-text-wrap'> {{ item?.description }} </ion-card-content> -->
</ion-card>
</ion-row>
</ion-grid>
</ion-content>
How it looks enter image description here
Solution
You need to wrap each row in a column.
<ion-grid>
<ion-col size="12">
<ion-row *ngFor = let item of items'>
<ion-card>
<ion-img [src]='item.imagePath'></ion-img>
<ion-header>
<ion-card-title class='ion-text-center'> {{ item?.title }} </ion-card-title>
<ion-card-subtitle class='ion-text-center'> {{ item?.price }} </ion-card-subtitle>
</ion-header>
<!-- <ion-card-content class='ion-text-wrap'> {{ item?.description }} </ion-card-content> -->
</ion-card>
</ion-row>
</ion-col>
</ion-grid>
and in you CSS do this....
ion-card{
display: flex;
flex-direction: column;
width: 100% !important;
margin: 0 !important;
}
Answered By - E. Maggini
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.