I have a sign up form with 6 input
items inside a form
element which is a flex container. The flex-direction
is column
in the form, therefore all input
elements get displayed 1 per row:
Is there a way to make it display two items per row, like this:
I tried setting flex-direction: row
and putting
<div class="line-break"></div>
.line-break {
width: 100%;
}
after each input
element, but it didn't work.
form {
width: 100%;
height: 100%;
/*
border: 1px solid white;
*/
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
/*
Just for style, nevermind it
*/
.form-input {
height: 20px;
width: 50%;
background-color: silver;
border-radius: 10px;
border: none;
padding: 6px;
margin: 15px;
}
<form action="/login">
<h2 class="form-title">Sing up</h2>
<input class="form-input" type="text" placeholder="First Name" name="firstname">
<div class="line-break"></div>
<input class="form-input" type="text" placeholder="Last Name" name="lastname">
<input class="form-input" type="text" placeholder="Email" name="email">
<input class="form-input" type="password" placeholder="Password" name="password">
<input class="form-input" type="password" placeholder="Confirm" name="confirm">
<input class="form-input" type="text" placeholder="Age" name="age">
</form>