htmlcssformshtml-input

How to align texts inside of an input?


For all default inputs, the text you fill starts on the left. How do you make it start on the right?


Solution

  • Use the text-align property in your CSS:

    input { 
        text-align: right; 
    }
    

    This will take effect in all the inputs of the page.
    Otherwise, if you want to align the text of just one input, set the style inline:

    <input type="text" style="text-align:right;"/>