How to vertically center a container in Bootstrap?

后端 未结 9 1548
囚心锁ツ
囚心锁ツ 2020-11-22 09:06

I\'m looking for a way to vertically center the container div inside the jumbotron and to set it in the middle of the page.

The .jum

9条回答
  •  没有蜡笔的小新
    2020-11-22 09:45

    In Bootstrap 4:

    to center the child horizontally, use bootstrap-4 class:

    justify-content-center
    

    to center the child vertically, use bootstrap-4 class:

     align-items-center
    

    but remember don't forget to use d-flex class with these it's a bootstrap-4 utility class, like so

    MIDDLE

    Note: make sure to add bootstrap-4 utilities if this code does not work

    I know it's not the direct answer to this question but it may help someone

提交回复
热议问题