博客列表 >Bootstrap基础--2019-05-24

Bootstrap基础--2019-05-24

小人物的博客
小人物的博客原创
2019年05月26日 21:17:29472浏览
  1. 自动动手写一个Bootstrap模板文件


  2. 实例

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <!--    1. 导入bootstrap的css文档-->
        <link rel="stylesheet" href="static/css/bootstrap.css">
        <title>Title</title>
    </head>
    <body>
    
    <!--2. 导入支持文件: jquery.js-->
    <script src="static/js/jquery-3.4.1.js"></script>
    <!--3. 导入bootstrap的js文件-->
    <script src="static/js/bootstrap.js"></script>
    </body>
    </html>

    运行实例 »

    点击 "运行实例" 按钮查看在线实例

2. 自己动手写一个适应所有阈值的栅格布局小案例

实例

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>栅格布局小案例</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <link rel="stylesheet" href="static/css/bootstrap.css">
    <style>
        .grid {
            border: 1px solid #696969;
            border-radius: 5px;
            /*background-color: wheat;*/
            min-height: 50px;
            text-align: center;
            line-height: 50px;
        }

    </style>
</head>
<body>

<div class="container">
    <div class="row">
        <div class="col-lg-3 col-md-6 col-sm-8 col-xs-2 grid bg-info">左</div>
        <div class="col-lg-9 col-md-6 col-sm-4 col-xs-10 grid bg-warning">右</div>


    </div>
</div>


<script src="static/js/jquery-3.4.1.js"></script>
<script src="static/js/bootstrap.js"></script>
</body>
</html>

运行实例 »

点击 "运行实例" 按钮查看在线实例

3. 模仿课堂案例写一个布局页面, 内容自定

实例

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!--    1. 导入bootstrap的css文档-->
    <link rel="stylesheet" href="static/css/bootstrap.css">
    <title>Title</title>
</head>
<body>
    <div class="container">
        <!--导航-->
        <div class="row">
            <div class="col-md-12">
                <nav class="navbar navbar-inverse">
                    <div class="container-fluid">
                        <!-- Brand and toggle get grouped for better mobile display -->
                        <div class="navbar-header">
                            <a class="navbar-brand" href="#">
                                <!--<img alt="Brand" src="static/images/girl.jpg" style="width:30px;height:30px">-->
                            </a>
                            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                                <span class="sr-only">Toggle navigation</span>
                                <span class="icon-bar"></span>
                                <span class="icon-bar"></span>
                                <span class="icon-bar"></span>
                            </button>
                            <a class="navbar-brand" href="#">我的博客</a>
                        </div>

                        <!-- Collect the nav links, forms, and other content for toggling -->
                        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                            <ul class="nav navbar-nav">
                                <li class="active"><a href="#">首页 <span class="sr-only">(current)</span></a></li>
                                <!--<li><a href="#">Link</a></li>-->
                                <li class="dropdown">
                                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">学习内容 <span class="caret"></span></a>
                                    <ul class="dropdown-menu">
                                        <li><a href="#">HTML5</a></li>
                                        <li><a href="#">CSS</a></li>
                                        <li><a href="#">JavaScript</a></li>
                                        <li role="separator" class="divider"></li>
                                        <li><a href="#">PHP</a></li>
                                        <li role="separator" class="divider"></li>
                                        <li><a href="#">MySQL</a></li>
                                    </ul>
                                </li>
                            </ul>
                            <!--<form class="navbar-form navbar-left">-->
                            <!--<div class="form-group">-->
                            <!--<input type="text" class="form-control" placeholder="Search">-->
                            <!--</div>-->
                            <!--<button type="submit" class="btn btn-default">Submit</button>-->
                            <!--</form>-->

                            <!--<ul class="nav navbar-nav navbar-right">-->
                            <!--<li><a href="#">Link</a></li>-->
                            <!--<li class="dropdown">-->
                            <!--<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">学习内容 <span class="caret"></span></a>-->
                            <!--<ul class="dropdown-menu">-->
                            <!--<li><a href="#">HTML5</a></li>-->
                            <!--<li><a href="#">CSS</a></li>-->
                            <!--<li><a href="#">JavaScript</a></li>-->
                            <!--<li role="separator" class="divider"></li>-->
                            <!--<li><a href="#">PHP</a></li>-->
                            <!--</ul>-->
                            <!--</li>-->
                            <!--</ul>-->
                        </div><!-- /.navbar-collapse -->
                    </div><!-- /.container-fluid -->
                </nav>
            </div>


        </div>
            <!--内容区-->



            <div class="row">


                <div class="col-md-6 col-md-push-6">
                    <div class="page-header">
                        <h1>最新博文 <small>分享学习乐趣</small></h1>
                    </div>
                    <div class="list-group">
                        <a href="#" class="list-group-item active">
                            Cras justo odio
                        </a>
                        <a href="#" class="list-group-item">Dapibus ac facilisis in</a>
                        <a href="#" class="list-group-item">Morbi leo risus</a>
                        <a href="#" class="list-group-item">Porta ac consectetur ac</a>
                        <a href="#" class="list-group-item">Vestibulum at eros</a>
                    </div>
                </div>
                <div class="col-md-6 col-md-pull-6">
                        <div class="row">
                            <div class="col-md-10 col-md-offset-1">
                                <img src="static/images/girl.jpg" alt="" class="img-responsive img-rounded">
                            </div>
                        </div>
                    </div>
        </div>
    </div>


<!--2. 导入支持文件: jquery.js-->
<script src="static/js/jquery-3.4.1.js"></script>
<!--3. 导入bootstrap的js文件-->
<script src="static/js/bootstrap.js"></script>
</body>
</html>

运行实例 »

点击 "运行实例" 按钮查看在线实例


声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议