其他分享
首页 > 其他分享> > 3.WEB前端--BootStrap

3.WEB前端--BootStrap

作者:互联网

 BootStrap

        <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
        <link rel="stylesheet" href="../css/bootstrap.css" />
        
        <!--需要引入JQuery-->
        <script type="text/javascript" src="../js/jquery-1.11.0.js" ></script>
        
        <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
        <script type="text/javascript" src="../js/bootstrap.js" ></script>
        
        <meta name="viewport" content="width=device-width, initial-scale=1">

.container 类用于固定宽度并支持响应式布局的容器。

<div class="container">
  ...
</div>

.container-fluid 类用于 100% 宽度,占据全部视口(viewport)的容器。

<div class="container-fluid">
  ...
</div>
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <link rel="stylesheet" href="../css/bootstrap.css" />
        <script type="text/javascript" src="../js/jquery-1.11.0.js" ></script>
        <script type="text/javascript" src="../js/bootstrap.js" ></script>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title></title>
    </head>
    <body>
        <div class="container">
            
            <!--logo 部分-->
            <div class="row">
                <div class="col-md-4 col-sm-6 col-xs-6">
                    <img src="../img/logo2.png"/>
                </div>
                <div class="col-md-4 hidden-sm hidden-xs">
                    <img src="../img/header.png" />
                </div>
                <div class="col-md-4 col-sm-6 col-xs-6" style="line-height: 50px;">
                    <a href="#">登录</a>
                    <a href="#">注册</a>
                    <a href="#">购物车</a>
                </div>
            </div>

            <!--导航栏 部分-->
            <nav class="navbar navbar-inverse">
                <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">
                    <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>
                                <a href="#">鞋靴箱包</a>
                            </li>
                            <li>
                                <a href="#">香煙酒水</a>
                            </li>
                            <li class="dropdown">
                                <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">全部分類 <span class="caret"></span></a>
                                <ul class="dropdown-menu" role="menu">
                                    <li>
                                        <a href="#">手機數碼</a>
                                    </li>
                                    <li>
                                        <a href="#">電腦辦公</a>
                                    </li>
                                    <li>
                                        <a href="#">Something else here</a>
                                    </li>
                                    <li class="divider"></li>
                                    <li>
                                        <a href="#">Separated link</a>
                                    </li>
                                    <li class="divider"></li>
                                    <li>
                                        <a href="#">One more separated link</a>
                                    </li>
                                </ul>
                            </li>
                        </ul>
                        <form class="navbar-form navbar-right" role="search">
                            <div class="form-group">
                                <input type="text" class="form-control" placeholder="Search">
                            </div>
                            <button type="submit" class="btn btn-default">Submit</button>
                        </form>
                        
                    </div>
                    <!-- /.navbar-collapse -->
                </div>
                <!-- /.container-fluid -->
            </nav>
            
            
            <!--輪播圖 部分-->
            
                <div id="carousel-example-generic" class="carousel slide" data-ride="carousel" data-interval="2000">
                    <!-- Indicators -->
                    <ol class="carousel-indicators">
                        <li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
                        <li data-target="#carousel-example-generic" data-slide-to="1"></li>
                        <li data-target="#carousel-example-generic" data-slide-to="2"></li>
                        <li data-target="#carousel-example-generic" data-slide-to="3"></li>
                    </ol>
            
                    <!-- Wrapper for slides -->
                    <div class="carousel-inner" role="listbox">
                        <div class="item active">
                            <img src="../img/4.jpg" alt="...">
                            <div class="carousel-caption">
                                ...
                            </div>
                        </div>
                        <div class="item">
                            <img src="../img/5.jpg" alt="...">
                            <div class="carousel-caption">
                                ...
                            </div>
                        </div>
                        <div class="item">
                            <img src="../img/8.jpg" alt="...">
                            <div class="carousel-caption">
                                ...
                            </div>
                        </div>
                        <div class="item">
                            <img src="../img/1.jpg" alt="...">
                            <div class="carousel-caption">
                                ...
                            </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 class="sr-only">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 class="sr-only">Next</span>
                    </a>
                </div>
            

            <!--最新商品  部分-->
            <div class="row">
                <div class="col-md-12">
                    <h3>最新商品<img src="../images/../img/title2.jpg" /></h3>
                    
                </div>
            </div>

            <!--商品 部分-->
            <div class="row">
                <!--左边大图-->
                <div class="col-md-2 hidden-sm hidden-xs" style="height: 480px;">
                    <img src="../products/hao/big01.jpg" />
                </div>
                
                <!--右边商品部分-->
                <div class="col-md-10">
                    <div class="col-md-6 hidden-sm hidden-xs" style="height: 240px;">
                        <img src="../products/hao/middle01.jpg"/>
                    </div>
                    <div class="col-md-2 col-sm-4 col-xs-6" style="text-align: center; height: 240px;">
                        <img src="../products/hao/small07.jpg" />
                        <p>盒子</p>
                        <p style="color: red;">$299</p>
                    </div>
                    <div class="col-md-2 col-sm-4 col-xs-6" style="text-align: center; height: 240px;">
                        <img src="../products/hao/small07.jpg" />
                        <p>盒子</p>
                        <p style="color: red;">$299</p>
                    </div>
                    <div class="col-md-2 col-sm-4 col-xs-6" style="text-align: center; height: 240px;">
                        <img src="../products/hao/small07.jpg" />
                        <p>盒子</p>
                        <p style="color: red;">$299</p>
                    </div>
                    <div class="col-md-2 col-sm-4 col-xs-6" style="text-align: center; height: 240px;">
                        <img src="../products/hao/small07.jpg" />
                        <p>盒子</p>
                        <p style="color: red;">$299</p>
                    </div>
                    <div class="col-md-2 col-sm-4 col-xs-6" style="text-align: center; height: 240px;">
                        <img src="../products/hao/small07.jpg" />
                        <p>盒子</p>
                        <p style="color: red;">$299</p>
                    </div>
                    <div class="col-md-2 col-sm-4 col-xs-6"  style="text-align: center; height: 240px;">
                        <img src="../products/hao/small07.jpg" />
                        <p>盒子</p>
                        <p style="color: red;">$299</p>
                    </div>
                    <div class="col-md-2 col-sm-4 col-xs-6" style="text-align: center; height: 240px;">
                        <img src="../products/hao/small07.jpg" />
                        <p>盒子</p>
                        <p style="color: red;">$299</p>
                    </div>
                    <div class="col-md-2 col-sm-4 col-xs-6" style="text-align: center; height: 240px;">
                        <img src="../products/hao/small07.jpg" />
                        <p>盒子</p>
                        <p style="color: red;">$299</p>
                    </div>
                    <div class="col-md-2 col-sm-4 col-xs-6" style="text-align: center; height: 240px;">
                        <img src="../products/hao/small07.jpg" />
                        <p>盒子</p>
                        <p style="color: red;">$299</p>
                    </div>
                    
                    
                    
                </div>
            </div>

            <!--logo 部分-->
            <div class="row">
                <div class="col-md-12">
                    <img src="../products/hao/ad.jpg" width="100%"/>
                </div>
            </div>

            <!--复制 部分-->
            <div class="row">
                <!--左边大图-->
                <div class="col-md-2 hidden-sm hidden-xs" style="height: 480px;">
                    <img src="../products/hao/big01.jpg" />
                </div>
                
                <!--右边商品部分-->
                <div class="col-md-10">
                    <div class="col-md-6 hidden-sm hidden-xs" style="height: 240px;">
                        <img src="../products/hao/middle01.jpg"/>
                    </div>
                    <div class="col-md-2 col-sm-4 col-xs-6" style="text-align: center; height: 240px;">
                        <img src="../products/hao/small07.jpg" />
                        <p>盒子</p>
                        <p style="color: red;">$299</p>
                    </div>
                    <div class="col-md-2 col-sm-4 col-xs-6" style="text-align: center; height: 240px;">
                        <img src="../products/hao/small07.jpg" />
                        <p>盒子</p>
                        <p style="color: red;">$299</p>
                    </div>
                    <div class="col-md-2 col-sm-4 col-xs-6" style="text-align: center; height: 240px;">
                        <img src="../products/hao/small07.jpg" />
                        <p>盒子</p>
                        <p style="color: red;">$299</p>
                    </div>
                    <div class="col-md-2 col-sm-4 col-xs-6" style="text-align: center; height: 240px;">
                        <img src="../products/hao/small07.jpg" />
                        <p>盒子</p>
                        <p style="color: red;">$299</p>
                    </div>
                    <div class="col-md-2 col-sm-4 col-xs-6" style="text-align: center; height: 240px;">
                        <img src="../products/hao/small07.jpg" />
                        <p>盒子</p>
                        <p style="color: red;">$299</p>
                    </div>
                    <div class="col-md-2 col-sm-4 col-xs-6"  style="text-align: center; height: 240px;">
                        <img src="../products/hao/small07.jpg" />
                        <p>盒子</p>
                        <p style="color: red;">$299</p>
                    </div>
                    <div class="col-md-2 col-sm-4 col-xs-6" style="text-align: center; height: 240px;">
                        <img src="../products/hao/small07.jpg" />
                        <p>盒子</p>
                        <p style="color: red;">$299</p>
                    </div>
                    <div class="col-md-2 col-sm-4 col-xs-6" style="text-align: center; height: 240px;">
                        <img src="../products/hao/small07.jpg" />
                        <p>盒子</p>
                        <p style="color: red;">$299</p>
                    </div>
                    <div class="col-md-2 col-sm-4 col-xs-6" style="text-align: center; height: 240px;">
                        <img src="../products/hao/small07.jpg" />
                        <p>盒子</p>
                        <p style="color: red;">$299</p>
                    </div>
                    
                    
                    
                </div>
            </div>

            <!--footer 部分-->
            <div class="row">
                <div class="col-md-12">
                    <img src="../img/footer.jpg"  width="100%"/>
                </div>
            </div>
            <div class="col-md-12 " style="text-align: center;">
                    <a href="#">关于我们</a>
                    <a href="#">联系我们</a>
                    <a href="#">法律声明</a>
                    <a href="#">关于我们</a>
                    <a href="#">关于我们</a>
                    <a href="#">关于我们</a>
            </div>
        </div>
        
    </body>
</html>

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
        <style>
        </style>
        <link rel="stylesheet" href="../css/laohuangli.css" />

        <script type="text/javascript" src="../js/jquery-1.11.0.js" ></script>
        <!--
            编程开发的过程遇到问题
                达不到预期效果
                1.检查自己代码
                2.使用断点调试工具 javascript
                3.百度 or 问同学 or 问同事
                4.问老师
                5.老师问总监
        -->
        <script>
            $(function(){   //文档加载事件
                //涉及到请求链接, 动态显示数据
                
                var url = "http://127.0.0.1:8020/day05-bootStrap/data.json";
                
                //ajax  最简单异步请求网络
                // jsonArr  对应 url 返回的数据,是一个数组
                
                $.get(url,function(jsonArr){
//                    console.log(jsonArr);
//                    var obj = jsonArr[4];  // JSONObject
                    var goodCount = Math.floor(Math.random()*3+3)  // 随机数可能有小数,向上取整
                    
                    while(goodCount > 0){                  //取几条数据,决定循环几次
                        
                        //随机去取一条数据
                        var index = Math.floor(Math.random()*jsonArr.length)     ;      //随机数和 数组长度相乘,求得当前要取出数据索引
                        var obj = jsonArr[index];           // 取出来数据
                        
                        // 获取适合干什么的数据
                        $(".good ul").append("<li><div class='name'>"+obj.name+"</div><div class='description'>"+obj.good+"</div></li>")
                        goodCount--;
                        
                    }
                    
                    
                    var badCount = Math.floor(Math.random()*3+2) //
                    while(badCount > 0){
                        var index = Math.floor(Math.random()*jsonArr.length)
                        var obj = jsonArr[index];
                        
                        //获取不适合做什么的数据
                         $(".bad ul").append("<li><div class='name'>"+obj.name+"</div><div class='description'>"+obj.bad+"</div></li>")
                        badCount--;
                    }
                    
                    
                },"json");
                
                
                
            });
        </script>
    </head>
    <body>
        <div class="container">
            <div class="title">
                程序员老黄历
            </div>
            <div class="good">
                <div class="title">
                    <table>
                        <tr><td>宜</td></tr>
                    </table>
                </div>
                <div class="content">
                    <ul>
                        
                    </ul>
                </div>
                <div class="clear"></div>
            </div>
            
            <div class="split"></div>
            
            <div class="bad">
                <div class="title">
                    <table>
                        <tr><td>不宜</td></tr>
                    </table>
                </div>
                <div class="content">
                    <ul>
                        
                    </ul>
                </div>
                <div class="clear"></div>
            </div>
        </div>
    </body>
</html>

 

标签:WEB,盒子,前端,BootStrap,299,var,Math,row
来源: https://blog.csdn.net/Lsc_hei/article/details/88185869