博客列表 >Bootstrap导入与布局原理 —2018年9月20日23时45分

Bootstrap导入与布局原理 —2018年9月20日23时45分

感恩的心的博客
感恩的心的博客原创
2018年10月02日 20:28:26560浏览

1、将Bootstrap正确的引入到html文档中

实例

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>bootstrap</title>
	<link rel="stylesheet" href="./lib/dist/css/bootstrap.css">
	<script src="./lib/jquery.js"></script>
	<script src="./lib/dist/js/bootstrap.js"></script>
</head>
<body>
	<div>
		<a href="" class="collapsing">Close.</a>
		<strong>Alert:</strong>Keep Attention!
	</div>
</body>
</html>

运行实例 »

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


2. 使用常见的组件,实现一个博客的首页布局

实例

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <link rel="stylesheet" href="http://cdn.bootcss.com/bootstrap/3.2.0/css/bootstrap.css">
        <style>
            .grid {
                border: 1px solid #696969;
                border-radius: 5px;
                background-color: lightskyblue;
                min-height: 50px;
                text-align: center;
                line-height: 50px;
            }
        </style>
        <title>Bootstrap</title>
    </head>
    <body>
        <div class="container">
            <div class="col-md-12" >
                <nav class="navbar navbar-default">
                    <div class="container-fluid">
                        <!-- Brand and toggle get grouped for better mobile display -->
                        <div class="navbar-header">
                            <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="#">链接</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="#">儒家</a></li>
                                        <li><a href="#">佛学</a></li>
                                        <li><a href="#">道家</a></li>
                                        <li role="separator" class="divider"></li>
                                        <li><a href="#">圣贤教育</a></li>
                                        <li role="separator" class="divider"></li>
                                        <li><a href="#">更多</a></li>
                                    </ul>
                                </li>
                            </ul>
                            <form class="navbar-form navbar-left">
                                <div class="form-group">
                                    <input type="text" class="form-control" placeholder="搜索">
                                </div>
                                <button type="submit" class="btn btn-default">提交</button>
                            </form>
                            <ul class="nav navbar-nav navbar-right">
                                <li><a href="#">链接</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="#">儒家</a></li>
                                        <li><a href="#">佛学</a></li>
                                        <li><a href="#">道家</a></li>
                                        <li role="separator" class="divider"></li>
                                        <li><a href="#">圣贤教育</a></li>
                                    </ul>
                                </li>
                            </ul>
                        </div><!-- /.navbar-collapse -->
                    </div><!-- /.container-fluid -->
                </nav>

            </div>

        </div>
        <script src="http://libs.baidu.com/jquery/2.0.0/jquery.js"></script>
        <script src="http://apps.bdimg.com/libs/bootstrap/3.2.0/js/bootstrap.js"></script>	
    </body>
</html>

运行实例 »

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



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