For below html code
.shoppingform {
width: 400px;
height: 800px;
background: #7CB9E8;
padding-left: 15px;
padding-top: 10px;
color: white;
font-size: 12px;
font-weight: bold;
border-radius: 5px;
}
.customername {
border: 1px solid white;
color: black;
font-weight: normal;
padding: 10px 2px 5px 5px;
background: #B284BE;
width: 90%;
border-radius: 5px;
}
.customername {
height: 5%;
}
.customername {
margin-top: 5px;
}
.shoppingform > div > input {
border-radius: 5px;
width: 60%;
}
.formlabel {
display: inline-block;
width: 30%;
}
<form class="shoppingform" action="someaction.php" method="get" enctype="multipart/form-data">
Step1: Your details
<br>
<div class="customername">
<label class="formlabel">Name:</label>
<input type="text">
</div>
</form>
Run codeHide resultThere are several elements div(e.g. customername) that do not have the code above to make the question simple.
labeland the inputtext is at the top of the container div.
How to vertically align the text labeland inputin the middle of the container div? To add, there are several elements in the form div.
source
share