垂直和水平对齐(Boostrap 4)

时间:2016-11-01 18:49:50

标签: html css twitter-bootstrap

我试图垂直和水平对齐文字和按钮,但却无法做到...... 我最终想要的是对齐是否响应。 我的代码: HTML:

    <div id="stage">
    <div id="stage-caption">
      <h1 class="display-3">Gallery Nellija</h1>
      <p>Some description</p>
      <a href="" class="btn btn-lg btn-success">Sign up now</a>
    </div>
 </div>

CSS:

#stage {
    background: url('img/stage.jpg') center center no-repeat;
    background-size: cover;
    color: white;
    height: 100%;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

#stage-caption {
    font-size: 1.4rem;
    font-weight: 200;
    max-width: 60rem;
    margin: 0 auto;
}

#stage-caption h1 {
    color: white;
    font-weight: bold;
    text-transform: uppercase;
}

现在它看起来像是:

enter image description here

提前致谢!

1 个答案:

答案 0 :(得分:1)

text-align:center添加到#stage