Align input text to center?

Is it possible to align the text a user types into an input?

for aesthetic reasons, I need it to appear in the center rather than on the left hand side, but the usual ‘text-align: center’ doesn’t seem to work with the ionic 2 component :frowning2:

thanks for everything :slight_smile:

Take a look at the utility attrs for ionic2

1 Like

That did it thanks :slight_smile:
I’d been using a div with onClick="this.contentEditable='true';" , but that hadn’t worked quite how I wanted it to.

This is perfect! :smiley:

Try this style.

        ion-input{ 
            .text-input{ text-align: center; }
        }

It worked for me on Ionic 3.
Hope this will help you :slight_smile:

2 Likes

In ionic 3 , try this :

<ion-input type=“text” placeholder=“Latitude” [value]=“lat” name=“latt” text-right #latt readonly>

only add : text-right or text-center or text-left in your ion-input

It works :slight_smile: