3

I have this html in ionic

<ion-label color="primary" stacked>Email</ion-label>
<ion-input type="email" placeholder="Email Input"></ion-input>

how to make text input align-text in right side

Gabriel Barreto
  • 6,411
  • 2
  • 24
  • 47
Indra suandi
  • 141
  • 1
  • 3
  • 15

3 Answers3

13

ionic 3:

<ion-input text-center></ion-input>
Hizabr
  • 423
  • 5
  • 6
  • It really is that easy now it seems like. To right align, `text-right` works as well. Surprised this isn't documented. – Adam Specker Jul 23 '20 at 21:16
10

Inside of every ion-input there's a input, this input is what you need to style, just do the following:

ion-input {
  input {
    text-align: right;
    /* IF YOU ALSO WANT TO PUSH PLACHEHOLDER TO THE RIGHT USE THE FOLLOWING, IF NOT JUST DELETE THE ::-webkit-input-placeholder*/
    ::-webkit-input-placeholder {
      text-align: right;
    }
  }
}

Hope this helps.

Gabriel Barreto
  • 6,411
  • 2
  • 24
  • 47
0
<div class="topPedding">
    <ion-item>
      <ion-input type="text" placeholder="Username" text-center></ion-input>
    </ion-item>
    <ion-item>
      <ion-input type="password" placeholder="Password" text-center></ion-input>
    </ion-item>
    <ion-item class="border-none" lines="none">
      <ion-toggle color="primary"></ion-toggle>
      <ion-label>Rem[![enter image description here][1]][1]ember Password</ion-label>
    </ion-item>
    <ion-button color="light" expand="block">Sign In</ion-button>
  </div>
Abdullah
  • 2,393
  • 1
  • 16
  • 29