In Bootstrap 4, if you want to vertically align a <div> element in the center or middle, you can simply apply the class align-items-center on the containing element.
The following example will show you how to vertical align a grid column inside a row.
Similarly, you can align a DIV element vertically in the middle of a containing element by using the class d-flex in combination with the class align-items-center, like this:
<div class="d-flex align-items-center">
<div class="box">Vertical Center Align a Div</div>
</div>
However, if you're using the Bootstrap 3 version you can still do it with some custom CSS. Let's try out the following example to understand how it basically works:
Use the
align-items-center
ClassIn Bootstrap 4, if you want to vertically align a
<div>
element in the center or middle, you can simply apply the classalign-items-center
on the containing element.The following example will show you how to vertical align a grid column inside a row.
Similarly, you can align a DIV element vertically in the middle of a containing element by using the class d-flex in combination with the class align-items-center, like this:
However, if you're using the Bootstrap 3 version you can still do it with some custom CSS. Let's try out the following example to understand how it basically works:
need an explanation for this answer? contact us directly to get an explanation for this answer