bootstarp栅格系统

Posted 米小玉

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了bootstarp栅格系统相关的知识,希望对你有一定的参考价值。

<!DOCTYPE html>
<html lang="zh-cn">
  <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>

    <!-- Bootstrap -->
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <style>
      .container{
        border: 1px solid #ccc;
      }
    </style>
  </head>
  <body>
<!-- 从堆叠到水平排列 -->
  <div class="container">
    <div class="row">
      <div class="col-xs-1">col-xs-1</div>
      <div class="col-xs-1">col-xs-1</div>
      <div class="col-xs-1">col-xs-1</div>
      <div class="col-xs-1">col-xs-1</div>
      <div class="col-xs-1">col-xs-1</div>
      <div class="col-xs-1">col-xs-1</div>
      <div class="col-xs-1">col-xs-1</div>
      <div class="col-xs-1">col-xs-1</div>
      <div class="col-xs-1">col-xs-1</div>
      <div class="col-xs-1">col-xs-1</div>
      <div class="col-xs-1">col-xs-1</div>
      <div class="col-xs-1">col-xs-1</div>
    </div>
  </div>
  <div class="container">
      <div class="row">
        <div class="col-xs-8">col-xs-8</div>
        <div class="col-xs-4">col-xs-4</div>
      </div>
      <div class="row">
        <div class="col-xs-4">col-xs-4</div>
        <div class="col-xs-4">col-xs-4</div>
        <div class="col-xs-4">col-xs-4</div>
      </div>
  </div>

<!-- 列偏移 -->
  <div class="container">
    <div class="row">
      <div class="col-xs-3 col-xs-offset-3 bg-info" >col-xs-3</div>
      <div class="col-xs-3 col-xs-offset-3 bg-info">col-xs-3</div>
    </div>
  </div>

<br>
<!-- 嵌套列 -->
      <div class="row">
        <div class="col-sm-8 bg-primary">col-xs-8</div> 
        <div class="row">
          <div class="col-xs-4 col-sm-6 bg-success" >col-xs-4</div> 
          <div class="col-xs-8 col-sm-6 bg-info">col-xs-4</div> 
        </div>      
  </div>
  <br>
<!-- 列排序 -->
  <div class="row">
    <div class="col-md-9 col-md-push-3 bg-warning">col-md-9 col-md-push-3</div>
    <div class="col-md-3 col-md-pull-9 bg-danger">col-md-3 col-md-pull-9</div>
  </div>

<br>
    <!-- jQuery (necessary for Bootstrap‘s javascript plugins) -->
    <script src="http://cdn.bootcss.com/jquery/1.11.1/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="js/bootstrap.min.js"></script>
  </body>
</html>

  

以上是关于bootstarp栅格系统的主要内容,如果未能解决你的问题,请参考以下文章

bootstarp 网格系统

Web前端之移动端课程开发之06.bootstrap

Web前端之移动端课程开发之06.bootstrap

bootstrap栅格系统底层设计原理

使用Bootstrap前端框架的栅格系统搭建页面布局

less 实现栅格系统