The accepted answer here is correct, but I would like to add some information. If you use a library / framework such as bootstrap, classes can be created for this. For example, bootstrap uses the text-right class. Use it like this:
<input type="text" class="text-right"/> <input type="number" class="text-right"/>
As a note, this also works with other types of input, such as numeric, as shown above.
If you are not using a good framework like bootstrap, you can create your own version of this helper class. Like other answers, but we are not going to add it directly to the input class, so it will not apply to all inputs of your site or page, this may be an undesirable behavior. This way, it will create a good css class to align objects without the need for inline styling or impact on every input window.
.text-right{ text-align: right; }
Now you can use this class in the same way as the inputs above with class="text-right" . I know that this does not save a lot of key touches, but it makes your code cleaner.
Doug E Fresh Aug 22 '17 at 15:43 on 2017-08-22 15:43
source share