I have several number inputs of varying lengths which I want to style such that the input boxes are not longer than necessary:
<input type=number name=short value='1' min=0 max=9 size=1 maxlength=1>
<input type=number name=medium value='123' min=0 max=999 size=3 maxlength=3>
<input type=number name=long value='12345' min=0 max=99999 size=5 maxlength=5>
Firefox does not recognise number
type input and will process the input assuming they are text
boxes. Therefore the size
and maxlength
will be applied to the input boxes.
Chrome recognizes the number
type input and will automatically limit the size of the input box based on max
value plus the width of the spin(up/down) buttons.
However, Opera, which also recognizes the number
type input does things differently. It uses the size
value to calculate the size of the input box, or browser default if none is provided. It does not take into account the width of the spin buttons, causing part of the input to be obscured.
Is there a way to style the number inputs properly such that they are not longer than necessary and taking into account of the problem I mentioned with Opera browser?