Examining the HTML and CSS code below:
* {
box-sizing: border-box;
}
.field {
overflow: auto;
}
.field label {
float: left;
width: 80px;
}
.field input {
display: block;
width: 100%;
}
<div class="field">
<label>Test</label>
<input type="text">
</div>
Regardless of using Firefox or Chromium, the output appears as follows:
However, my intention is for the <input>
to be displayed on the same line as the <label>
. Essentially, like this:
Why does setting float: left;
not position the label to the left of the input?