码迷,mamicode.com
首页 > 移动开发 > 详细

移动web——bootstrap栅格系统

时间:2018-01-15 16:40:26      阅读:206      评论:0      收藏:0      [点我收藏+]

标签:sheet   ima   alt   响应   info   nts   cdn   war   dual   

基本简介

1、Bootstrap 提供了一套响应式、移动设备优先的流式栅格系统,随着屏幕或视口(viewport)尺寸的增加,系统会自动分为最多12列

2、栅格系统用于通过一系列的行(row)与列(column)的组合来创建页面布局

3、“行(row)”必须包含在 .container (固定宽度)或 .container-fluid (100% 宽度)中,以便为其赋予合适的排列(aligment)和内补(padding)。

基本案例

<!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">
    <!-- 上述3个meta标签*必须*放在最前面,任何其他内容都*必须*跟随其后! -->
    <title>Bootstrap 101 Template</title>

    <!-- Bootstrap -->
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <style>
        .row div {
            border: 1px solid #000;
        }
    </style>

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn‘t work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="https://cdn.bootcss.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body>
<div class="container">
    <div class="row">
        <div class="col-lg-1">1</div>
        <div class="col-lg-1">1</div>
        <div class="col-lg-10">10</div>
    </div>
    <div class="row">
        <div class="col-md-1">1</div>
        <div class="col-md-1">1</div>
        <div class="col-md-10">10</div>
    </div>
    <div class="row">
        <div class="col-sm-1">1</div>
        <div class="col-sm-1">2</div>
        <div class="col-sm-10">10</div>
    </div>
    <div class="row">
        <div class="col-xs-1">1</div>
        <div class="col-xs-1">1</div>
        <div class="col-xs-10">10</div>
    </div>
</div>

<br><br>

<div class="container-fluid">
    <div class="row">
        <div class="col-xs-12 col-sm-6 col-md-4 col-lg-3">简介1</div>
        <div class="col-xs-12 col-sm-6 col-md-4 col-lg-3">简介2</div>
        <div class="col-xs-12 col-sm-6 col-md-4 col-lg-3">简介3</div>
        <div class="col-xs-12 col-sm-6 col-md-4 col-lg-3">简介4</div>
        <div class="col-xs-12 col-sm-6 col-md-4 col-lg-3">简介5</div>
        <div class="col-xs-12 col-sm-6 col-md-4 col-lg-3">简介6</div>
        <div class="col-xs-12 col-sm-6 col-md-4 col-lg-3">简介7</div>
        <div class="col-xs-12 col-sm-6 col-md-4 col-lg-3">简介8</div>
    </div>
</div>

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

技术分享图片

移动web——bootstrap栅格系统

标签:sheet   ima   alt   响应   info   nts   cdn   war   dual   

原文地址:https://www.cnblogs.com/wuqiuxue/p/8288200.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!