-2

After looking through the bootstrap 4 Flex doc, I can't seem to get the "align-item-center" property to work. I tested pretty much every example available online but really can't seem to change the vertical alignment of anything, it's driving me nuts. I join a simple HTML example I'm trying to make work.

.d-flex {
  display: -ms-flexbox !important;
  display: flex !important;
}

.justify-content-center {
  -ms-flex-pack: center !important;
  justify-content: center !important;
}

.align-items-center {
  -ms-flex-align: center !important;
  align-items: center !important;
}
<div class="d-flex justify-content-center align-items-center">
  <p> This should be centered right ?</p>
</div>

I'm using Bootstrap 4.4.1 and also have installed popper.js@latest and jquery@latest just to be sure. For further precision I'm only using a simple textline now but in the future I'll add elements whose size are not known until runtime.

DonutsSauvage
  • 157
  • 1
  • 1
  • 5

1 Answers1

-2

Set height to parent to the screen size or whatever you want i set it to 100% of view-port height

.d-flex.justify-content-center.align-items-center {
    height: 100vh;
}
Awais
  • 4,752
  • 4
  • 17
  • 40