Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ionic 3 angular ion-slide vertical align top

I am using ionic 3 ion-slides and ion-slide. The issue I am facing is the contents are in the center and I want it to be top aligned. Code looks like:

<ion-content padding>

    <ion-slides pager>
      <ion-slide style="vertical-align:top">
          <ion-card padding>
           <ion-card-header class="ha-card-header">About you</ion-card-header>
              <ion-card-content>
                    <ion-label>Family Size&nbsp;<ion-badge>{{energyProfile.familySize}}</ion-badge></ion-label>
                    <ion-item no-padding>
                        <ion-range [(ngModel)]="energyProfile.familySize" min="0" max="10" step="2">
                          <ion-icon range-left small name="person"></ion-icon>
                          <ion-icon range-right name="people"></ion-icon>
                        </ion-range>
                    </ion-item>
              </ion-card-content>
            </ion-card>
      </ion-slide>
</ion-slides>
<ion-content>
like image 644
Vik Avatar asked Jul 27 '17 06:07

Vik


1 Answers

You can use a css rule to do that:

ion-slide.swiper-slide {
    align-items: flex-start;
}

The default is align-items: center;.

EDIT:

From @Ryan Coolwebs comments:

You may also find (on some occasions) that you also will now need to adjust the pagination component as it will be under the '.swiper-wrapper' with significant whitespace (i.e placing the ion-slides component within col layout).

A reasonable solution is to inset the pagination by assigning this css:

ion-slides.slides {
  height: auto;
}

.swiper-pagination {
  bottom: 0px;
}

Then adjust the transparency settings and colors of pagination system.

like image 50
sebaferreras Avatar answered Nov 20 '22 00:11

sebaferreras