The estate justify-content: space-between;
positions the two elements at each end of the div (in your case, vertical ends).
By your CSS, you are applying it to the direct daughter Ivs of the form, which is affecting for heredity the subdivs of these Ivs.
Just change these adding subdivs justify-content: flex-start;
(see the line commented with /* AQUI!! */
in the code below):
form {
display: flex;
flex-direction: column;
padding: 20px;
margin-top: 20px;
border-radius: 4px;
background: #fff;
label {
font-weight: bold;
margin: 15px 0 5px 0;
font-size: 14px;
}
input {
height: 30px;
border-radius: 4px;
border: 1px solid rgba(0, 0, 0, 0.1);
padding-left: 15px;
}
div {
display: flex;
justify-content: space-between;
div {
display: flex;
flex-direction: column;
justify-content: flex-start; /* AQUI!! */
input {
width: 240px;
}
}
}
}
Now, notice that when the message is displayed, there is a break in the grid,
causing one div to touch the other. To resolve this,
add flex: 1;
below the property I suggested above. That
force the 3 Divs to maintain width fixed and equal and don’t touch a
another.
Take an example:
I changed the width of inputs to 140px just to illustrate.
form {
display: flex;
flex-direction: column;
padding: 20px;
margin-top: 20px;
border-radius: 4px;
background: #fff;
}
form label {
font-weight: bold;
margin: 15px 0 5px 0;
font-size: 14px;
}
form input {
height: 30px;
border-radius: 4px;
border: 1px solid rgba(0, 0, 0, 0.1);
padding-left: 15px;
}
form div {
display: flex;
justify-content: space-between;
}
form div div {
display: flex;
flex-direction: column;
justify-content: flex-start;
flex: 1;
}
form div div input {
width: 140px;
}
<form>
<div>
<div>
<label>Idade</label>
<input type="text">
<div>mensagem mensagem mensagem mensagem mensagem mensagem mensagem mensagem</div>
</div>
<div>
<label>Peso</label>
<input type="text">
</div>
<div>
<label>Altura</label>
<input type="text">
<div>mensagem mensagem mensagem mensagem mensagem mensagem mensagem mensagem</div>
</div>
</div>
</form>
See how it looks without the properties suggested above:
I recommend you keep the Complete guide on flexbox, which is very useful for references, queries and ask questions.
perfect, that’s right, thank you very much.
– David Borelli
@Davidborelli thank you young man, qq doubt comments ai that I try to help you! Abs
– hugocsl