I’m trying to align a button with review information but failing to do so for the moment.
This is my HTML code. There is an ion-list wrapping the ion-grid so ion-item contains an ng
<ion-list>
<ion-grid no-padding>
<ion-item text-wrap *ngFor="let item of [1, 2, 3]">
<ion-row>
<ion-col width-40>
<img [src]="imageSrc">
</ion-col>
<ion-col width-60>
<h2 class="topName">{{name}}</h2>
<ion-col class="bottomReviews" width-50>
<p> 10 Reviews</p>
</ion-col>
<ion-col class="bottomReviews" width-50>
<button class="bottomShare" clear small>
<ion-icon name='share-alt'></ion-icon>
<label text-capitalize>Share</label>
</button>
</ion-col>
</ion-col>
</ion-row>
</ion-item>
</ion-grid>
</ion-list>
And this is my CSS
.bottomReviews {
position: absolute; //This is positioned relative to the nearest positioned ancestor
bottom: 15px;
}
.topName {
position: absolute; //This is positioned relative to the nearest positioned ancestor
top: 15px;
font-size: 110%;
}
//To take out the padding in ion-label stored within ion-item
ion-grid > ion-item.item > div.item-inner > div.input-wrapper > ion-label {
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
margin-left: 0px;
}
//To take out the padding in ion-col
ion-label > ion-row > ion-col {
padding-top: 5px;
padding-right: 5px;
padding-bottom: 0px;
padding-left: 5px;
}
Edit: I was able to align everything by using ion-row, ion-col and taking out all the position: absolute;