Bootstrap: Bootstrap 网格
Bootstrap: Bootstrap Grid
我正在尝试使用 Bootstrap 网格概念在一行中创建 12 列,而不是在一个容器中得到 12 行。
我完成的代码
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"/>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<title>document</title>
<style>
.box{
background-color:aquamarine;
border-style: solid;
height: 100px;
}
.row{
margin-top:10px;
}
</style>
</head>
<body>
<div class="container-fluid jumbotron">
<div class="container">
<h2>BootStrap Grid</h2>
</div>
</div>
<div class="container-fluid">
<div class="row">
<div class="col-1 box">1</div>
<div class="col-1 box">2</div>
<div class="col-1 box">3</div>
<div class="col-1 box">4</div>
<div class="col-1 box">5</div>
<div class="col-1 box">6</div>
<div class="col-1 box">7</div>
<div class="col-1 box">8</div>
<div class="col-1 box">9</div>
<div class="col-1 box">10</div>
<div class="col-1 box">11</div>
<div class="col-1 box">12</div>
</div>
</div>
</body>
</html>
Image of what I was getting
Image of what I should get
我是 Bootstrap 的新手,有人可以解决我的问题吗?
参考文档,你使用的版本类都有一个断点。
使用:
<div class="col-xs-1 box">1</div>
此外,与所述问题无关,但是,您将 bootstrap.js 放在了错误的位置并省略了所需的 jquery 脚本。它们应该包含在结束 </body>
标记之前,如“入门”模板中所示。
- https://getbootstrap.com/docs/3.3/css/#grid
- https://getbootstrap.com/docs/3.3/getting-started/#template
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" />
<title>document</title>
<style>
.box {
background-color: aquamarine;
border-style: solid;
height: 100px;
}
.row {
margin-top: 10px;
}
</style>
</head>
<body>
<div class="container-fluid jumbotron">
<div class="container">
<h2>BootStrap Grid</h2>
</div>
</div>
<div class="container-fluid">
<div class="row">
<div class="col-xs-1 box">1</div>
<div class="col-xs-1 box">2</div>
<div class="col-xs-1 box">3</div>
<div class="col-xs-1 box">4</div>
<div class="col-xs-1 box">5</div>
<div class="col-xs-1 box">6</div>
<div class="col-xs-1 box">7</div>
<div class="col-xs-1 box">8</div>
<div class="col-xs-1 box">9</div>
<div class="col-xs-1 box">10</div>
<div class="col-xs-1 box">11</div>
<div class="col-xs-1 box">12</div>
</div>
</div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
</body>
</html>
我正在尝试使用 Bootstrap 网格概念在一行中创建 12 列,而不是在一个容器中得到 12 行。
我完成的代码
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"/>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<title>document</title>
<style>
.box{
background-color:aquamarine;
border-style: solid;
height: 100px;
}
.row{
margin-top:10px;
}
</style>
</head>
<body>
<div class="container-fluid jumbotron">
<div class="container">
<h2>BootStrap Grid</h2>
</div>
</div>
<div class="container-fluid">
<div class="row">
<div class="col-1 box">1</div>
<div class="col-1 box">2</div>
<div class="col-1 box">3</div>
<div class="col-1 box">4</div>
<div class="col-1 box">5</div>
<div class="col-1 box">6</div>
<div class="col-1 box">7</div>
<div class="col-1 box">8</div>
<div class="col-1 box">9</div>
<div class="col-1 box">10</div>
<div class="col-1 box">11</div>
<div class="col-1 box">12</div>
</div>
</div>
</body>
</html>
Image of what I was getting
Image of what I should get
我是 Bootstrap 的新手,有人可以解决我的问题吗?
参考文档,你使用的版本类都有一个断点。
使用:
<div class="col-xs-1 box">1</div>
此外,与所述问题无关,但是,您将 bootstrap.js 放在了错误的位置并省略了所需的 jquery 脚本。它们应该包含在结束 </body>
标记之前,如“入门”模板中所示。
- https://getbootstrap.com/docs/3.3/css/#grid
- https://getbootstrap.com/docs/3.3/getting-started/#template
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" />
<title>document</title>
<style>
.box {
background-color: aquamarine;
border-style: solid;
height: 100px;
}
.row {
margin-top: 10px;
}
</style>
</head>
<body>
<div class="container-fluid jumbotron">
<div class="container">
<h2>BootStrap Grid</h2>
</div>
</div>
<div class="container-fluid">
<div class="row">
<div class="col-xs-1 box">1</div>
<div class="col-xs-1 box">2</div>
<div class="col-xs-1 box">3</div>
<div class="col-xs-1 box">4</div>
<div class="col-xs-1 box">5</div>
<div class="col-xs-1 box">6</div>
<div class="col-xs-1 box">7</div>
<div class="col-xs-1 box">8</div>
<div class="col-xs-1 box">9</div>
<div class="col-xs-1 box">10</div>
<div class="col-xs-1 box">11</div>
<div class="col-xs-1 box">12</div>
</div>
</div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
</body>
</html>