How to vertically center a container in Bootstrap?

后端 未结 9 1547
囚心锁ツ
囚心锁ツ 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:25

    Update 2020

    Bootstrap 4 includes flexbox, so the method of vertical centering is much easier and doesn't require extra CSS.

    Just use the d-flex and align-items-center utility classes..

    content

    http://www.codeply.com/go/ui6ABmMTLv

    Important: Vertical centering is relative to height. The parent container of the items you're attempting to center must have a defined height. If you want the height of the page use vh-100 or min-vh-100 on the parent! For example:

    I am centered vertically

    Also see: https://stackoverflow.com/questions/42252443/vertical-align-center-in-bootstrap-4

提交回复
热议问题