Bootstrap Studio:在页面中央放置一个巨型加速器

时间:2018-08-27 12:07:07

标签: bootstrap-4 bootstrap-studio

这就是我想要的 What I want

这就是我得到的... 我尝试添加行/列,但它们仅影响从上到下的移动,过去我曾经能够在巨无霸的左侧放置一列/行,但是现在我再也不能了...我有东西吗缺少行和列? enter image description here

这是我的代码:

<html>

<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Mailsafe</title>
    <link rel="stylesheet" href="bootstrap.min.css" />
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Bitter:400,700" />
    <link rel="stylesheet" href="Header-Dark.css" />
    <link rel="stylesheet" href="styles.css" />
</head>

<body id="hero" style="background-color:#004878;">
    <section class="d-flex mse spacer" id="hero">
        <div id="hero-top"></div>
        <div id="hero-bottom"></div>
    </section>
    <div>
        <div class="container">
            <div class="row">
                <div class="col">
                    <div class="jumbotron flex-grow-0 flex-shrink-1" id="gateway">
                        <h1 class="text-center">Company Name</h1>
                        <p class="text-center"><br />Company blah blah<br />company blah blah blah.<br /><br /></p>
                        <p class="text-center"><a class="btn btn-primary" href="#" style="  width:673px;
">Get Started →</a></p>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>

</html>

1 个答案:

答案 0 :(得分:0)

在正文上添加100%的高度,并在容器的包装div上添加html和d-flex h-100 align-items-center类。此外,从入门锚中删除宽度并向其中添加显示块。

html,
body {
  height: 100%;
  margin: 0;
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">

<body id="hero" style="background-color:#004878;">
  <section class="d-flex mse spacer" id="hero">
    <div id="hero-top"></div>
    <div id="hero-bottom"></div>
  </section>
  <div class="d-flex h-100 align-items-center">
    <div class="container">
      <div class="row">
        <div class="col">
          <div class="jumbotron flex-grow-0 flex-shrink-1" id="gateway">
            <h1 class="text-center">Company Name</h1>
            <p class="text-center"><br />Company blah blah<br />company blah blah blah.<br /><br /></p>
            <p class="text-center"><a class="btn btn-primary" href="#" style="display:block;">Get Started →</a></p>
          </div>
        </div>
      </div>
    </div>
  </div>
</body>