JanR JanR - 6 months ago 33
HTML Question

Number input halves in size when using min and max

When making an input, like so:

<input type="number" min="0" max="100"><br>
<input type="number" min="0" max="99"><br>
<input type="number" min="1" max="100"><br>
<input type="number" min="1" max="99"><br>

It shortens the width of the input field, specifically when max is at 100. Since i've never seen this, i can only guess it does this thinking i will use percentages or currency, which i actually do, but i do not want this. Is there another way to prevent this from happening besides using different values or changing the size of the input yourself?


This is a default behaviour of how some browsers render those inputs. So the answer is NO. If you want to have a certain width, take a look at the other answers.