首页 > 代码库 > bootstrap学习5-栅格系统

bootstrap学习5-栅格系统

<!DOCTYPE html>
<html lang="zh-cn">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no"  />
    <title>栅格系统</title>
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <style>
        .a{
            background-color: antiquewhite;
            border: 1px solid chartreuse;
            height: 50px;
        }
        
        
    </style>
  </head>
 <!--Bootstrap的栅格系统,提供了一套响应移动设备优先的流式栅格系统
     栅格系统中,浏览器会随着屏幕的大小的增减自动分配最多12列
 -->
  <!--
    移动优先
  //屏幕宽度和设备一致 ,初始缩放比例,最大缩放比例和禁止用户缩放  
  <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no"  />
  -->
  <!--
      container 容器 
      container-fluid 全屏幕100%
      四种屏幕:<768px 超小屏幕  col-xs 
          >=768px min-width 750px平板  col-sm
          >=992px min-width 970px中等屏幕 col-md
          >=1200px min-width 1170px大屏幕 col-lg
  -->
  
  <div class="container-fluid">
      <div class="row">
      <div class="col-md-1 a">1</div>
      <div class="col-md-1 a">2</div>
      <div class="col-md-1 a">3</div>
      <div class="col-md-1 a">4</div>
      <div class="col-md-1 a">5</div>
      <div class="col-md-1 a">6</div>
      <div class="col-md-1 a">7</div>
      <div class="col-md-1 a">8</div>
      <div class="col-md-1 a">9</div>
      <div class="col-md-1 a">10</div>
      <div class="col-md-1 a">11</div>
      <div class="col-md-1 a">12</div>
      </div>
      <div class="row">
      <div class="col-md-4 a">10</div>
      <div class="col-md-4 a">11</div>
      <div class="col-md-4 a">12</div>
      </div>
      <div class="row">
      <div class="col-md-9 a">10</div>
      <div class="col-md-3 a">11</div>
      </div>
  </div>
  
  
  <div class="container">
      <div class="row">
      <div class="col-lg-3 col-md-4 col-sm-6 col-xs-12 a">1</div>
      <div class="col-lg-3 col-md-4 col-sm-6 col-xs-12 a">2</div>
      <div class="col-lg-3 col-md-4 col-sm-6 col-xs-12 a">3</div>
      <div class="col-lg-3 col-md-4 col-sm-6 col-xs-12 a">4</div>
      <div class="col-lg-3 col-md-4 col-sm-6 col-xs-12 a">5</div>
      <div class="col-lg-3 col-md-4 col-sm-6 col-xs-12 a">6</div>
      <div class="col-lg-3 col-md-4 col-sm-6 col-xs-12 a">7</div>
      <div class="col-lg-3 col-md-4 col-sm-6 col-xs-12 a">8</div>
      </div>
  </div>
  <!--
      列偏移 col-md-offset-
      嵌套  注意去除外边距
      col-md-push- 左移动
      col-md-pull- 右移动    
  -->
  
  
  <div class="container">
      <div class="row">
          <div class="col-md-8 a">8</div>
          <div class="col-md-3 col-md-offset-1 a">3</div>
      </div>
      <div class="row" >
          <div class="col-md-9 a" style="padding: 0;">
              <div class="col-md-3 a">1</div>
              <div class="col-md-3 a">2</div>
              <div class="col-md-3 a">3</div>
              <div class="col-md-3 a">4</div>
          </div>
          <div class="col-md-3 col a">3</div>
      </div>
      <div class="row">
          <div class="col-md-8 col-md-push-4 a">8</div>
          <div class="col-md-4 col-md-pull-8 a">4</div>
      </div>
  </div>
  
  
  
  
    <!-- 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>

 

bootstrap学习5-栅格系统