Home > Software design >  How to align the placeholder to center alignment in ion-input?
How to align the placeholder to center alignment in ion-input?

Time:01-22

How to align the placeholder to center alignment in ion-input ????

this is my ionic input fields in left alignments

i tried to move center alignment, but i could't , please tell me anyone the correct solution

CodePudding user response:

in your CSS file with your tag add this to align placeholder text in the center.

Tag:

<ion-input type="text" placeholder="Type something"></ion-input>

Design:

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

try this it should work.

CodePudding user response:

You should find the element classes with browser's developer tools and make your changes to them. Add this to your css file:

.native-input::placeholder{
  text-align: center;
}

or you can use a class in your html file if you don't want it to apply to all of your inputs in the page:

.my-input .native-input::placeholder{
  text-align: center;
}

  • Related