I'm attempting to create a layout with 3 forms, whereof I only have 1 form in place. My question is how come the content expands to total height, making the input fields and button to high. This is not visible when having only the "form-1" but I need to add several forms in parallel, so adding only one form does not solve the needs.
Question: How can I set the height to be same as the labels, without setting fixed heights?
.wrapper-for-forms {
display: grid;
grid-template:
'form-1 form-2 form-3' 500px
/1fr 1fr 1fr;
}
.form-1 {
display: grid;
grid-template-columns: 200px 400px;
grid-gap: 16px;
}
.form-1 {
margin-top: 10px;
}
label {
grid-column: 1 / 2;
}
input,
button {
grid-column: 2 / 3;
}
<div class="wrapper-for-forms">
<form class="form-1">
<label for="firstName" class="first-name">First Name</label>
<input id="firstName" type="text">
<label for="lastName" class="last-name">Last Name</label>
<input id="lastName" type="text">
<button>Submit</button>
</form>
<div class="form-2">Form-2</div>
<div class="form-3">Form-3</div>
</div>