What can I do to have these inputs vertically aligned in Firefox?
It works in Chrome, Safari and Opera but not in Firefox (Version 57 tested in macOS, Windows and Linux Mint). Removing type="number"
from the input
solves it in Firefox but isn't something I want to remove.
label {
display: inline-block;
}
.form-control {
display: block;
}
<body>
<label>First number <input class="form-control" type="number"></label>
<label>
Dropdown
<select class="form-control">
<option label="First option" selected="selected">
First option
</option>
</select>
</label>
</body>
you need to reset the vertical-align
property on your inline-block
displayed elements.
label {
display: inline-block;
vertical-align: top;
}
.form-control {
display: block;
}
<body>
<label>
First number
<input class="form-control" type="number">
</label>
<label>
Dropdown
<select class="form-control">
<option label="First option" selected="selected">
First option
</option>
</select>
</label>
</body>