1
The form
is within a class called container
which has the following attributes:
`
.container {
width: 80%;
margin: auto;
padding: 30px;
}
If I add one text-align:center
in the container, I can center the form. However, when I do this, the Abels that are on top of the inputs are centered on the input as well.
How can I center the form without it happening?
The html of the Form is this:
<form>
<div class="form-group">
<label for="name">Nome:</label>
<input type="text" name="name" id="name" required>
</div>
<div class="form-group">
<label for="age">Idade:</label>
<input type="number" name="age" id="age" required>
</div>
<div class="form-group">
<label for="work-area">Área de atuação:</label>
<select name="work-area" id="work-area" required>
<option value="developer">Desenvolvedor</option>
<option value="infra">Infraestrutura</option>
<option value="designer">Designer</option>
</select>
</div>
<div class="form-group">
<label for="vacation">Férias?</label>
<input type="checkbox" name="vacation" id="vacation">
</div>
<div class="form-group">
<label for="entry-date">Data de entrada:</label>
<input type="date" required id="entry-date">
</div>
<button type="submit">Salvar</button>
</form>
Right, and where is the HTML of this form? Will we have to create them to test? Read this post https://pt.meta.stackoverflow.com/questions/5483/manual-de-como-n%C3%83o-fazer-perguntas/5485#5485
– user60252
@Leocaracciolo added.
– Naldson
see if with
width: 50%;
be sure– user60252
He went a little to the right, but did not center.
– Naldson
By the classes it seems that you are using Bootstrap check? If you are which version is?
– hugocsl
@hugocsl I’m not. The form-group and container, I created.
– Naldson
Ok young is because the classes have the same names rss. Of qq way I have posted an example as response that can help you.
– hugocsl
@Leocaracciolo Actually your solution worked. It’s that I had gotten confused with the size of the inputs, because I’m using percentage.
– Naldson