Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Center form input and placeholder?

I am using AngularJS and Ionic.

I have an email input field:

<input type="password" placeholder="Password" ng-model="data.password">

where I would like to center the text. I have attempted both:

<input type="password" placeholder="Password" ng-model="data.password" class="align-center">
<input type="password" placeholder="Password" ng-model="data.password" class="center">

but neither attempt made a difference.

  • Why didn't any of the attempts succeed?
  • How can I center the text?
  • Is this a situation where adding a styling framework like Bootstrap would be beneficial?
like image 544
user1283776 Avatar asked Nov 19 '15 13:11

user1283776


2 Answers

Literally all you need is to add a text-align:center to your input field through a CSS class or an inline style. We can't see what kind of CSS the classes you tried to use include, so we can't really know why they didn't work out for you. :(

Fiddle:

http://jsfiddle.net/HB7LU/20067/

like image 138
Fissio Avatar answered Oct 14 '22 04:10

Fissio


you can use this bootstrap class to center the text

class="text-center"

like this:

<input type="password" placeholder="Password" ng-model="data.password" class="text-center">
like image 42
Dyrandz Famador Avatar answered Oct 14 '22 03:10

Dyrandz Famador