Bootstrap网格无法正常工作?

时间:2017-10-03 18:54:46

标签: css bootstrap-4

我正在加载bootstrap网格以使我的网站响应。但是,我的div并没有对tempaltes作出反应。这个想法是在标准的macbook或大屏幕上,div占据了页面的第3个。并在移动100%。我的代码有什么问题。我装了bootstrap吗?

 <html>
        <head>
            <link rel="stylesheet" type="text/css" href="./css/style.css">
            <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
            <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
            <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
        </head>
        <body>
            <div class="row">
                <div class"col-sm-12 col-lg-4 col-md-4" id="homeDiv1">
                </div>
                <div class"col-sm-12 col-lg-4 col-md-4" id="homeDiv2">
                </div>
                <div class"col-sm-12 col-lg-4 col-md-4" id="homeDiv3">
                </div>
            </div>
        </body>
        </html>

3 个答案:

答案 0 :(得分:4)

你的班级需要一个等号。

而不是

class"col-sm-12 col-lg-4 col-md-4"

你需要

class="col-sm-12 col-lg-4 col-md-4"

答案 1 :(得分:2)

<{1}}使用{ = )中的问题,例如class"col-sm-12 col-lg-4 col-md-4"

class="col-sm-12 col-lg-4 col-md-4"
.row div{
    background-color:pink;
    border:1px solid gray;
    height:40px;
    }

答案 2 :(得分:2)

只是错字

<div class="col-sm-12 col-lg-4 col-md-4" id="homeDiv1">

&#13;
&#13;
.row > div
{
  height:100px;
  background:#ccc;
  padding:5px;
}
&#13;
<html>
        <head>
            <link rel="stylesheet" type="text/css" href="./css/style.css">
            <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
            <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
            <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
        </head>
        <body>
        <div class="container">
            <div class="row">
                <div class="col-sm-12 col-lg-4 col-md-4" id="homeDiv1">1
                </div>
                <div class="col-sm-12 col-lg-4 col-md-4" id="homeDiv2">2
                </div>
                <div class="col-sm-12 col-lg-4 col-md-4" id="homeDiv3">3
                </div>
            </div>
         </div>
        </body>
        </html>
&#13;
&#13;
&#13;