Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set and align ion-select in center on toolbar in ionic

I want to set select-option on toolbar in ionic, but I'm unable to align it to center, I have tried many things... by using these methods I'm unable to do so,

<div text-center>
     <label class="email">
        <input type="email" placeholder="Email" name="email">
     </label>
 </div>

This method aligns input box to center but it doesn't align select-option to center. here is a stackblitz

<div text-center>
<ion-item>

              <ion-select [(ngModel)]="gaming" interface="popover">
                <ion-option selected value="empty">empty</ion-option>
                <ion-option value="n64">Nintendo64</ion-option>
                <ion-option value="ps">PlayStation</ion-option>
                <ion-option value="genesis">Sega Genesis</ion-option>
                <ion-option value="saturn">Sega Saturn</ion-option>
                <ion-option value="snes">SNES</ion-option>
              </ion-select>
            </ion-item>
</div>

still the results are same

.item-select{
    position: initial;
    margin-left: 100px;
    width:40%;
    text-align: center;
}

This also doesn't affect, can anyone tell me how to set select-option to center on the toolbar in ionic?

like image 289
gaurang Avatar asked Oct 23 '17 10:10

gaurang


1 Answers

I think text-center will not work as ion-select is component. I have worked it around by using ion-select in grid.

<ion-grid>
    <ion-row>
      <ion-col size="12" offset="4">
          <ion-item>
            <ion-select>
              <ion-select-option selected>item 1</ion-select-option>
                <ion-select-option>item 2</ion-select-option>
            </ion-select>
        </ion-item>
      </ion-col>
    </ion-row>
  </ion-grid>
like image 72
birju Avatar answered Sep 28 '22 01:09

birju