![
Hello, I don’t understand something about flexbox, as the image shows I used flexbox to arrange the different elements of a form, I declared display: flex only in the div that contains both label and input element and set a width of 200px for the label and width: 100% for the input element, but the thing is that I don’t understand why the label doesn’t reach 200px (image)?
Here’s the code:
HTML:
<div class=”container”>
<form class=”form”>
<div class=”form-group”>
<label for=”prénom”>Prénom* :</label>
<input
type=”text”
id=”prénom”
class=”input”
placeholder=”Entre ton prénom”
required
/>
</div>
CSS:
.container {
margin: 90px auto 0 auto;
width: 100%;
max-width: 690px;
background: rgba(255, 255, 255, 0.95);
padding: 3.5rem 3.5rem 1rem 3.5rem;
border-radius: 10px;
border: 3px solid #E18F5F;
}
.form {
width: 100%;
}
.form-group {
margin-bottom: 29px;
display: flex;
align-items: center;
}
.container .form .form-group label,
.container .form .form-group p {
width: 200px;
font-size: 1.3rem;
margin-right: 20px;
}
.container .form .form-group .input {
width: 100%;
height: 2.2rem;
padding: 0.375rem 0.75rem;
font-size: 1.1rem;
border: 1px solid #C1C3C2;
color: #495057;
border-radius: 4px;
transition: all 0.3 ease;
}