我正在加载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>
答案 0 :(得分:4)
你的班级需要一个等号。
而不是
class"col-sm-12 col-lg-4 col-md-4"
你需要
class="col-sm-12 col-lg-4 col-md-4"
答案 1 :(得分:2)
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">
.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;