Bootstrap 4的新功能,列是否发挥了应有的作用?

时间:2019-01-08 18:07:21

标签: html css

我对Bootstrap 4的使用经验有限,但不确定为什么我的页面会这样运行。我有这两行,我希望标题之一位于具有白色背景的容器上方。我正在尝试制作2列,一列用于边栏,一列用于右侧的内容,但是当我使用列时,它们只能堆叠,可以在此处看到-http://michaelfroseth.com/clients/notebook-html/subpage.html

我不知道为什么?他们似乎在行外运行良好,但是我不应该使用新行吗?任何文档或指向正确方向的信息将不胜感激!

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<script defer src="https://use.fontawesome.com/releases/v5.0.2/js/all.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link rel="stylesheet" href="./css/custom.css?v=2">
<title>Pam's Notebook | V1.0</title>
</head>
<body>
<div class="container mt-5">
  <div class="row">
    <div class="col-md-12">
    <h1 class="display-5"><span style="color:#fff;">Pam's Notebook</span> <span style="color:#CCAC23;">V1.0</span></h1>
    </div>  
  </div>
  <div class="row">
    <div class="login-container col-md-12">
      <div class="col-md-4">SIDEBAR</div>
      <div class="col-md-8">CONTENT</div>
    </div>
  </div>
</div>
<!-- ALL OF YOUR SITE CODE HERE -->
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<!-- ADDITIONAL JS HERE -->
</body>
</html>

1 个答案:

答案 0 :(得分:1)

您应该在容器内使用row,而不是将其用作包装器。

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<script defer src="https://use.fontawesome.com/releases/v5.0.2/js/all.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link rel="stylesheet" href="./css/custom.css?v=2">
<title>Pam's Notebook | V1.0</title>
</head>
<body>
<div class="container mt-5">
  <div class="row">
    <div class="col-md-12">
    <h1 class="display-5"><span style="color:#fff;">Pam's Notebook</span> <span style="color:#CCAC23;">V1.0</span></h1>
    </div>  
  </div>
    <div class="login-container col-md-12">
    <div class="row">
      <div class="col-md-4">SIDEBAR</div>
      <div class="col-md-8">CONTENT</div>
    </div>
  </div>
</div>
<!-- ALL OF YOUR SITE CODE HERE -->
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<!-- ADDITIONAL JS HERE -->
</body>
</html>