As you may know, with HTML5 when an input
has type="number"
the field is "customized". Two little arrows are added to the field (w3school example) but the numbers are still left aligned.
I saw that numbers should be right aligned (as discussed in this question).
Is it applying to input fields too? If so, why it's not implemented by default?
Answer
Number fields should not always be right-aligned
It often makes sense to right-align numbers when they are being compared to other number fields (e.g. in financial statements). This can help comparability and scannability.
However, sometimes number fields are unrelated or are mixed with text fields in a form, so left-alignment may promote better visual flow.
Given #1 and #2, plus the fact that HTML controls tend to be left-aligned by default, it makes sense to also keep the HTML5 number control left-aligned by default.
Note that you can always change the text-alignment of the input through CSS or inline styles (e.g. or
).
Here are some examples of why right alignment doesn't always make sense:
No comments:
Post a Comment