0

所以这就是我想要的 我想要的是

这就是我得到的......我尝试添加行/列,但它们只会影响从上到下的移动,我曾经能够在 jumbotron 的左侧放置一列/行,但现在我不能不再......列和行有什么我缺少的吗? 在此处输入图像描述

这是我的代码:

<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 →&lt;/a></p>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>

</html>

4

1 回答 1

0

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

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 →&lt;/a></p>
          </div>
        </div>
      </div>
    </div>
  </div>
</body>

于 2018-08-27T12:43:04.037 回答