0

Hi everyone i would like to ask you guys if how can i make the inputed value in the textbox go to center while the placeholder value will be remain on the left as always? help me please.

current code:

<style>
.number { text-align:left; }
</style>

<input type="text" class="number" placeholder=" 1.)" >
xplody
  • 103
  • 1
  • 13
  • possible duplicate of [Change an input's HTML5 placeholder color with CSS](http://stackoverflow.com/questions/2610497/change-an-inputs-html5-placeholder-color-with-css) – krishna Jun 01 '15 at 10:05

2 Answers2

4

style plcaeholder using css like this

::-webkit-input-placeholder {
   text-align:left;
}

:-moz-placeholder { /* Firefox 18- */
   text-align:left;
}

::-moz-placeholder {  /* Firefox 19+ */
   text-align:left; 
}

:-ms-input-placeholder {  
   text-align:left;
} 

Demo

krishna
  • 4,069
  • 2
  • 29
  • 56
0

By setting text-align:center in CSS for your textfield like:

input{text-align:center;}
TLama
  • 75,147
  • 17
  • 214
  • 392
Manoj Sharma
  • 596
  • 1
  • 6
  • 23
  • Well for this problem you need to take other alternate solution for example take label and put you placeholder value there and position it left of your textbox and make textbox value center so your value will remain center and placeholder will remain left always. – Manoj Sharma Feb 03 '14 at 10:29
  • use of placeholder is to act as hint which hides in typing in textbox,but your soln will not works as placeholder concept – krishna Feb 03 '14 at 10:46