码迷,mamicode.com
首页 > 其他好文 > 详细

Bootstrap示例

时间:2018-03-27 23:56:29      阅读:201      评论:0      收藏:0      [点我收藏+]

标签:Bootstrap 登录 模态框

1、示例一:登录注册

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
    <title>登录注册示例</title>
    <style>
        body {
            background-color: #eee;
        }
    </style>
</head>
<body>
<div>
    <div>
        <div class="col-md-4 col-md-offset-4" style="margin-top: 100px">
            <h1>请登录</h1>
            <form>
                <div>
                    <label for="inputEmail3" class="col-sm-2 control-label">邮箱</label>
                    <div>
                        <input type="email" id="inputEmail3" placeholder="Email">
                    </div>
                </div>
                <div>
                    <label for="inputPassword3" class="col-sm-2 control-label">密码</label>
                    <div>
                        <input type="password" id="inputPassword3" placeholder="Password">
                    </div>
                </div>
                <div>
                    <div class="col-sm-offset-2 col-sm-10">
                        <div>
                            <label>
                                <input type="checkbox">记住我
                            </label>
                        </div>
                    </div>
                </div>
                <div>
                    <div class="col-sm-offset-2 col-sm-8">
                        <button type="submit" class="btn btn-primary btn-block">登录</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
</body>
</html>

效果图如下:

技术分享图片

2、示例二:导航条


<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
    <title>导航条示例</title>
</head>
<body>
<nav class="navbar navbar-inverse navbar-fixed-top">
    <div>
        <!-- Brand and toggle get grouped for better mobile display -->
        <div>
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
                    data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                <span>Toggle navigation</span>
                <span></span>
                <span></span>
                <span></span>
            </button>
            <a href="#">Brand</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><a href="#">Link <span>(current)</span></a></li>
                <li><a href="#">Link</a></li>
                <li>
                    <a href="#" data-toggle="dropdown" role="button" aria-haspopup="true"
                       aria-expanded="false">Dropdown <span></span></a>
                    <ul>
                        <li><a href="#">Action</a></li>
                        <li><a href="#">Another action</a></li>
                        <li><a href="#">Something else here</a></li>
                        <li role="separator"></li>
                        <li><a href="#">Separated link</a></li>
                        <li role="separator"></li>
                        <li><a href="#">One more separated link</a></li>
                    </ul>
                </li>
            </ul>
            <ul class="nav navbar-nav navbar-right">
                <li><a href="#">Link</a></li>
                <li>
                    <a href="#" data-toggle="dropdown" role="button" aria-haspopup="true"
                       aria-expanded="false">Dropdown <span></span></a>
                    <ul>
                        <li><a href="#">Action</a></li>
                        <li><a href="#">Another action</a></li>
                        <li><a href="#">Something else here</a></li>
                        <li role="separator"></li>
                        <li><a href="#">Separated link</a></li>
                    </ul>
                </li>
            </ul>
        </div><!-- /.navbar-collapse -->
    </div><!-- /.container-fluid -->
</nav>
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
<script src="bootstrap/js/bootstrap.min.js"></script>
</body>
</html>

效果图如下:

技术分享图片

3、示例三:轮播图动态循环

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
    <title>轮播图示例</title>
</head>
<body>
    <div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
        <!-- Indicators -->
        <ol>
            <li data-target="#carousel-example-generic" data-slide-to="0"></li>
            <li data-target="#carousel-example-generic" data-slide-to="1"></li>
            <li data-target="#carousel-example-generic" data-slide-to="2"></li>
        </ol>
        <!-- Wrapper for slides -->
        <div role="listbox">
            <div class="item active">
                <img src="./banner_1.jpg" alt="...">
                <div>
                    <h3>Bootstrap-海阔天空!</h3>
                </div>
            </div>
            <div>
                <img src="./banner_2.jpg" alt="...">
                <div>
                    <h3>Bootstrap-最美黄昏!</h3>
                </div>
            </div>
            <div>
                <img src="./banner_3.jpg" alt="...">
                <div>
                    <h3>Bootstrap-自然力量!</h3>
                </div>
            </div>
        </div>
        <!-- Controls -->
        <a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
            <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
            <span>Previous</span>
        </a>
        <a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
            <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
            <span>Next</span>
        </a>
    </div>
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
<script src="bootstrap/js/bootstrap.min.js"></script>
    <script>
        $('.carousel').carousel({
          interval: 3000
        })
    </script>
</body>
</html>

注意:轮播图用到的相片必须是一样大小,否则可能不会出现轮播效果

4、示例四:模态框


<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
    <title>模态框示例</title>
</head>
<body>
<button data-toggle="modal" data-target="#myModal">点我弹出!</button>
<div id="myModal" class="modal fade" tabindex="-1" role="dialog">
    <div role="document">
        <div>
            <div>
                <button type="button" data-dismiss="modal" aria-label="Close"><span
                        aria-hidden="true">&times;</span></button>
                <h4>Modal title</h4>
            </div>
            <div>
                <form>
                    <div>
                        <label for="inputEmail3" class="col-sm-2 control-label">Email</label>
                        <div>
                            <input type="email" id="inputEmail3" placeholder="Email">
                        </div>
                    </div>
                    <div>
                        <label for="inputPassword3" class="col-sm-2 control-label">Password</label>
                        <div>
                            <input type="password" id="inputPassword3" placeholder="Password">
                        </div>
                    </div>
                </form>
            </div>
            <div>
                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                <button type="button" class="btn btn-primary">Save changes</button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
<script src="bootstrap/js/bootstrap.min.js"></script>
<script>
    $('#myModal').modal({
      backdrop:false,
      keyboard: false
    })
</script>
</body>
</html>

效果图如下:

技术分享图片


Bootstrap示例

标签:Bootstrap 登录 模态框

原文地址:http://blog.51cto.com/qidian510/2091833

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