Hello good, I have a question, I don't know how to align the text boxes (input) and the labels so that they are well centered, the fact is that I also have a textarea, to make the typical form, but it won't let me. I leave my code.
This would be the form
.formulario {
display: block;
padding: 10pxx;
}
<div class="formulario">
<form action="">
<div>
<label for="nombre">Nombre</label>
<input id="nombre" type="text">
</div>
<div>
<label for="asunto">Asunto</label>
<input id="asunto" type="text">
</div>
<div>
<label for="correo">Correo:</label>
<input id="correo" type="email">
</div>
<div>
<label for="nensaje">Mensaje</label>
<textarea name="" id="mensaje" cols="30" rows="10"></textarea>
</div>
I assume that by "center" you mean this.
You need to add the CSS to the other elements. Here I have made a basic fix:
If what you want is to align the boxes, it happens that the label
label
is of typeinline
, that is, its width will be the same as that occupied by the text and the form boxes will be placed right next to it.A simple solution would be to set the label
label
to typeinline-block
and give it a fixed width (width
):