How to invert the side that starts the digits in an HTML input?

1

For example in the 'Numeral formatting' part of this site link

When I type, numbers begin to be written from right to left, and the default is any input is from left to right.

How do I change the input to be this way when I type?

    
asked by anonymous 20.04.2018 / 22:22

1 answer

6

Do not use direction: rtl for this. Although it produces the expected result, this hurts HTML semantics, since the RTL proposal is to indicate that the content of that element is in a language that is written from right to left: it is a location property, not a formatting property.

As you just want to format the text, use the text alignment property.

input[type=number] {
  text-align: right;
}
<input type="number">
    
20.04.2018 / 22:32