I’m a newbie to web programming I was wondering how to align input boxes from the start and end with css here is the photo
enter image description here
here is the html and css code :
.input{
color: white;
text-align: center;
font-size: 15px;
font-family: Arial, Helvetica, sans-serif;
line-height: 250%;
align-content: start;
}
<div class="welcome">
<h1>WELCOME!</h1>
</div>
<form class="input">
<label for="fname">First name:</label>
<input type="text" id="fname" name="fname"><br>
<label for="lname">Last name:</label>
<input type="text" id="lname" name="lname"><br>
<label for="pnber">Phone number:</label>
<input type="tel" id="pnber" name="pnber"><br>
<label for="email">Email:</label>
<input type="email" id="pnber" name="email">
</form>
trying to align input boxes from start to end
2
Answers
Flexbox will do the job for this:
display: flex;
property makes the form container a flex container, allowing you to use flex propertiesalign-items: flex-start;
property aligns to the start of the container with vertical axis.align-self: flex-start;
for horizontal axis.margin-bottom
property adds some spacing between the label and input elementsHope this helps
Here it is. Hope it’s helpful.