0
The @Miguel response completely answers your question. Although there may be another approach. I imagine you want both the Abels and the inputs of the same length, of course depending on the type. For this you could create a set of classes, to configure different sizes. Example:
.coluna-1{
width: 10%;
}
.coluna-2{
width: 20%;
}
.coluna-3{
width: 30%;
}
.coluna-4{
width: 40%;
}
.coluna-5{
width: 50%;
}
.coluna-6{
width: 60%;
}
.coluna-7{
width: 70%;
}
.coluna-8{
width: 80%;
}
.coluna-9{
width: 90%;
}
.coluna-10{
width: 100%;
}
[class^="coluna-"]{
display: inline-block;
}
.linha{
display: flex;
display: -webkit-flex;
}
.alinhamento{
text-align: right;
margin-right: 1vw;
}
Then you could just indicate the size of each label and each input, and based on that you could use the attribute text-align
to align the Honeys as you wish.
Example with html:
.coluna-1{
width: 10%;
}
.coluna-2{
width: 20%;
}
.coluna-3{
width: 30%;
}
.coluna-4{
width: 40%;
}
.coluna-5{
width: 50%;
}
.coluna-6{
width: 60%;
}
.coluna-7{
width: 70%;
}
.coluna-8{
width: 80%;
}
.coluna-9{
width: 90%;
}
.coluna-10{
width: 100%;
}
[class^="coluna-"]{
display: inline-block;
}
.linha{
display: flex;
display: -webkit-flex;
}
.alinhamento{
text-align: right;
margin-right: 1vw;
}
<div class="linha">
<label class="coluna-2 alinhamento">
Data de Nascimento
</label>
<input type="number" class="coluna-3" placeholder="Apenas números">
<label class="coluna-2 alinhamento">
Municipio
</label>
<input class="coluna-3" type="text">
</div>
<div class="linha">
<label class="coluna-2 alinhamento">
Nome da mãe
</label>
<input type="number" class="coluna-3" placeholder="Apenas números">
<label class="coluna-2 alinhamento">
Nome do pai
</label>
<input class="coluna-3" type="text">
</div>
This is just a grid system outline, very well explained in W3C.
Are you using some kind of Bootstrap framework? If possible put what you already have of html/css that is easier to give you an accurate answer.
– hugocsl