I made a form with Bootstrap, but I need to position it in the middle of the screen.
I placed it with col-md-offset-?
horizontally, but I need to position it vertically.
Any way in BootStrap or should I do it on my own in a different CSS?
I made a form with Bootstrap, but I need to position it in the middle of the screen.
I placed it with col-md-offset-?
horizontally, but I need to position it vertically.
Any way in BootStrap or should I do it on my own in a different CSS?
There are several ways to center horizontally and vertically. You're talking about "offset" to center horizontally using Bootstrap's grid system , so it's better to understand the concept because col-md-?
numbers may vary:
Bootstrap GRID by default has 12 columns , see this image with lines of 6 and 12 columns :
So,ifyouwanttocenterthecolumncol-md-6
theoffsetshouldbe"3" , so there are 3 columns for each side, totaling 12 columns , it is easier to see the following image:
There are several ways to do this, as you have not put any code, it is difficult to be specific, here are some more professional solutions than others:
Place a container DIV of your form
with the following CSS:
height: 300px; /* obrigatório para centralizar verticalmente */
top:0px;
bottom:0px;
margin:auto;
position:absolute
Add% of% to your container or margin-top:100px
, adjust the value according to your need, but remember this is a false vertical center, when in fact you are pushing object down, and if height vary the distance will always be the same.
There is also form
, but it works with vertical-align:middle
only, maybe you have some gambiarra here.