I have been playing around with monofonts (because every character as wide as the next) to match length of input field.
How come 5rem
is equal to 10 characters? into my input field in both Chrome and Firefox? You would expect 10 characters to have width 10rem
:
input[type="text"] {
border: 0;
outline: 0;
background: transparent;
border-bottom: 2px solid black;
font-family: 'monospace';
overflow: hidden;
width: 5rem;
}
<body id="body">
<form onSubmit="return false">
<input type="text" placeholder="your name" maxlength="10" required />
<input type="submit" />
</form>
</body>