Answer the question
In order to leave comments, you need to log in
How to center a DIV vertically in Bootstrap?
Good afternoon. I want to center a DIV vertically in Bootstrap. This is my first time working with this framework.
I am attaching the code. Parent window height: 100vh and min-height: 600px;
<header>
<div class="container-fluid">
<div class="row">
<div class="col-md-5">
<h1>Доставка вкусной пиццы<br>в любую точку Москвы</h1>
<p class="expositionHeader">Бесплатная доставка по центру от XXX рублей</p>
</div>
</div>
</div>
</header>
header {
height: 100vh;
min-height: 600px;
}
Answer the question
In order to leave comments, you need to log in
There are 2 modern ways to do this dynamically
1 - flexbox
header {
height: 100vh;
min-height: 600px;
display: flex;
flex-direction: column;
justify-content: center;
}
header {
height: 100vh;
min-height: 600px;
position:relative
}
.container-fluid {
left:0;
width:100%;
position: absolute;
top: 50%;
transform: translateY(-50%);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question