bootstrap3入门一(栅格系统)

http://www.cnblogs.com/aehyok/tag/BootStrap前端设计/

一、bootstrap开发环境搭建
1. 下载bootstrap,  http://www.bootcss.com/
2.  下载jquery,  通过IE直接访问 http://code.jquery.com/jquery-2.0.3.min.js
3. 在html页面中导入bootstrap与jquery的js,css文件,.viewport的<meta>标签,这个标签可以修改在大部分的移动设备上面的显示,加如 if lt IE 9...等是为了在ie9               以下的兼容。
模板如下
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
<title>Insert title here</title>
<link href="css/bootstrap.min.css" rel="stylesheet" media="screen">
<!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
      <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
    <![endif]-->
<script src="js/jquery-2.0.3.min.js"></script>
<script src="js/bootstrap.min.js"></script>
</head>
<body>
    <div class="container">
        
    </div>
</body>
</html>

二. 栅格系统。
1. boostrap把桌面分隔成 由12行 * n 列的表格进行布局, 这是boostrap进行而已的核心。
2. .row 进行行级划分,必须包含在 .container下。
3.  col-xx-*进行列级划分,如下图
bootstrap3入门一(栅格系统)_第1张图片

<div class="container">
        <div class="row">
            <div class="col-md-3">1</div>
            <div class="col-md-3">2</div>
            <div class="col-md-3">3</div>
            <div class="col-md-3">4</div>
        </div>
        <div class="row">
            <div class="col-md-3">5</div>
            <div class="col-md-3">6</div>
            <div class="col-md-3">7</div>
            <div class="col-md-3">8</div>
        </div>
    </div>


4.列偏移, 通过 col-xx-offset-*来实现
    <div class="container">
        <div class="row">
            <div class="col-md-3">1</div>
            <div class="col-md-3">2</div>
            <div class="col-md-3">3</div>
            <div class="col-md-3">4</div>
        </div>
        <div class="row">
            <div class="col-md-3">5</div>
            <div class="col-md-3">6</div>
            <div class="col-md-3 col-md-offset-3">7</div>
        </div>
    </div>



   5. 列排序,能过.col-xx-push-* 和 .col-xx-pull-* 实现列的向左或向右排序
    <div class="container">
        <div class="row">
            <div class="col-md-3">1</div>
            <div class="col-md-3">2</div>
            <div class="col-md-3 col-md-push-3">3</div>
        </div>
        <div class="row">
            <div class="col-md-3">5</div>
            <div class="col-md-3">6</div>
            <div class="col-md-3 col-md-pull-2">7</div>
        </div>
    </div>


    6. 列嵌套, row嵌套在col中即可。
        <div class="row">
            <div class="col-md-3">1</div>
            <div class="col-md-3">2</div>
            <div class="col-md-3">3</div>
            <div class="col-md-3">
                <div class="row">
                    <div class="col-md-1">5</div>
                    <div class="col-md-1">6</div>
                    <div class="col-md-1">7</div>
                </div>
            </div>
        </div>



你可能感兴趣的:(bootstrap3入门一(栅格系统))