Bootstrap栅格系统简单实现代码

啊!洞庭湖的君山是多么雄伟壮观啊!就像一个忠诚的卫士守卫着洞庭湖,好让洞庭湖不受风雨的侵扰。一场小雨过后,出现了一道彩虹,就像一座美丽七彩桥。

Bootstrap栅格系统的简单介绍,供大家参考,具体内容如下

栅格系统:总共分为12个,超过12个会自动换行,可嵌套,嵌套也不可超过12个,且不会超过父栏

代码:

<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE-edge">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Bootstrap 101 Template</title>
<link rel="nofollow noopener noreferrer" href="http://cdn.bootcss.com/bootstrap/3.3.1/css/bootstrap-theme.min.css" rel="stylesheet">
<link rel="nofollow noopener noreferrer" href="http://cdn.bootcss.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet">
<style>
div{
 border:1px solid #cccccc;

}
</style>

</head>


<body>
<!-- 栅格系统 -->
<div class="container">
<div class="row">
<div class="bg-primary col-sm-9">A</div>
<div class="bg-success col-sm-2">B</div>
<div class="bg-info col-sm-1">C</div>
</div>
</div>

<!-- 中等屏幕与超小屏幕的处理 -->
<div class="container bg-primary">
<div class="row">
 <div class="col-xs-12 col-md-8">.col-xs-12 .col-md-8</div>
 <div class="col-xs-6 col-md-4">.col-xs-6 .col-md-4</div>
</div>
</div>


<!-- 偏移:offset -->
<div class="container">
<div class="row">
 <div class="col-md-4">.col-md-4</div>
 <div class="col-md-4 col-md-offset-4">.col-md-4 .col-md-offset-4</div>
</div>
<div class="row">
 <div class="col-md-3 col-md-offset-3">.col-md-3 .col-md-offset-3</div>
 <div class="col-md-3 col-md-offset-3">.col-md-3 .col-md-offset-3</div>
</div>
<div class="row">
 <div class="col-md-6 col-md-offset-3">.col-md-6 .col-md-offset-3</div>
</div>
</div>
<!-- 嵌套 -->
<div class="container">
<div class="row">
 <div class="col-sm-9">
 Level 1
 <div class="row">
  <div class="col-xs-8 col-sm-6">
  Level 2
  </div>
  <div class="col-xs-4 col-sm-6">
  Level 2
  </div>
 </div>
 </div>
</div>
</div>
<!-- pull:从右向左 push:从左向右 -->
<div class="container">
<div class="row">
<div class="col-md-9 col-md-push-3">.col-md-9 .col-md-push-3</div>
<div class="col-md-3 col-md-pull-9">.col-md-9 .col-md-pull-9</div>
</div>
<script src="http://cdn.bootcss.com/jquery/2.1.1/jquery.min.js"></script>
<script src="http://cdn.bootcss.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
<script src="http://cdn.bootcss.com/bootstrap/3.3.1/js/npm.js"></script>
</body>
</html>

结果:

以上就是Bootstrap栅格系统简单实现代码。幸福是什么?幸福就是,天亮了该睡觉,天黑了该活动。更多关于Bootstrap栅格系统简单实现代码请关注haodaima.com其它相关文章!

您可能有感兴趣的文章
bootstrap select2 动态从后台Ajax动态获取数据的代码

MVC遇上bootstrap后的ajax表单验证

浅谈Bootstrap的DatePicker日期范围选择

bootstrap datepicker的基本使用好代码教程

Bootstrap 时间日历插件bootstrap-datetimepicker配置与应用小结