1. 程式人生 > >JavaWeb05-HTML篇筆記(三)

JavaWeb05-HTML篇筆記(三)

Java

1.1 案例三:使用BootStrap布局首頁1.1.1 需求:
技術分享圖片
1.1.2 分析:1.1.2.1 技術分析:
【BootStrap的組件和JS的插件】
1.1.2.2 步驟分析:
【步驟一】:定義一個外層div元素
【步驟二】:定義裏層8個div
【步驟三】:為每層中的div添加元素.
1.1.3 代碼實現:

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- 根據設備寬度,調整縮放比例 -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>網站首頁</title>
<!-- 引入BootStrap的CSS -->
<link rel="stylesheet" href="../css/bootstrap.min.css" />
<link rel="stylesheet" href="../css/bootstrap-theme.min.css" />
<!-- 引入JS-->
<script type="text/javascript" src="../js/jquery-1.11.3.min.js" ></script>
<script type="text/javascript" src="../js/bootstrap.min.js" ></script>
</head>
<body>
<!--整體div-->
<div class="container">
<!--Logon部分DIV-->
<div class="row">
<div class="col-md-4">
<img src="../img/logo2.png" />
</div>
<div class="col-md-4">
<img src="../img/header.png" />
</div>
<div class="col-md-4">
<a href="">登錄</a>
<a href="">註冊</a>
<a href="">購物車</a>
</div>
</div>
<!--導航條部分DIV-->
<div class="row">
<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><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-haspopup="true" aria-expanded="false">更多 <span class="caret"></span></a>
          <ul class="dropdown-menu">
            <li><a href="#">Action</a></li>
            <li><a href="#">Another action</a></li>
            <li><a href="#">Something else here</a></li>
            <li role="separator" class="divider"></li>
            <li><a href="#">Separated link</a></li>
            <li role="separator" 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>
<!--圖片輪播部分DIV-->
<div class="row">
<!-- 圖片的小點兒 -->
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
  <!-- 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>
  <!-- 圖片-->
  <div class="carousel-inner" role="listbox">
    <div class="item active">
      <img src="../img/bartlesvillecf.jpg" >
      <div class="carousel-caption">

      </div>
    </div>
    <div class="item">
      <img src="../img/okwu-athletics.jpg">
      <div class="carousel-caption">

      </div>
    </div>
    <div class="item">
      <img src="../img/okwu.jpg">
      <div class="carousel-caption">

      </div>
    </div>
    <div class="item">
      <img src="../img/emancipation.jpg">
      <div class="carousel-caption">

      </div>
    </div>
  </div>
  <!-- 圖片左右選擇 -->
  <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>
<!--最新商品部分DIV-->
<div class="row">
<div >
<h3>最新商品<img src="../img/title2.jpg"></h3>
</div>
<div >
<div class="col-md-2" style="padding: 0px;height: 440px;">
<img src="../img/big01.jpg" width="100%" height="100%"/>
</div>
<div class="col-md-10">
<!--第一行-->
<div class="row" >
<div class="col-md-6" style="height:230px;padding: 0px;">
<img src="../img/middle01.jpg" height="100%" width="100%"/>
</div>
<div class="col-md-2">
<img src="../img/small01.jpg" />
<center><p>豆漿機</p>
<p style="color:red">¥299</p></center>
</div>
<div class="col-md-2">
<img src="../img/small02.jpg" />
<center><p>豆漿機</p>
<p style="color:red">¥299</p></center>
</div>
<div class="col-md-2">
<img src="../img/small03.jpg" />
<center><p>豆漿機</p>
<p style="color:red">¥299</p></center>
</div>
</div>
<!--第一行-->
<div class="row">
<div class="col-md-2">
<img src="../img/small01.jpg" />
<center><p>豆漿機</p>
<p style="color:red">¥299</p></center>
</div>
<div class="col-md-2">
<img src="../img/small02.jpg" />
<center><p>豆漿機</p>
<p style="color:red">¥299</p></center>
</div>
<div class="col-md-2">
<img src="../img/small03.jpg" />
<center><p>豆漿機</p>
<p style="color:red">¥299</p></center>
</div>
<div class="col-md-2">
<img src="../img/small01.jpg" />
<center><p>豆漿機</p>
<p style="color:red">¥299</p></center>
</div>
<div class="col-md-2">
<img src="../img/small02.jpg" />
<center><p>豆漿機</p>
<p style="color:red">¥299</p></center>
</div>
<div class="col-md-2">
<img src="../img/small03.jpg" />
<center><p>豆漿機</p>
<p style="color:red">¥299</p></center>
</div>
</div>
</div>
</div>
</div>
<!--廣告部分DIV-->
<div class="row">
<img src="../img/ad.jpg" width="100%"/>
</div>
<!--熱門商品部分DIV-->
<div class="row">
 <div >
<h3>熱門商品<img src="../img/title2.jpg"></h3>
</div>
<div >
<div class="col-md-2" style="padding: 0px;height: 440px;">
<img src="../img/big01.jpg" width="100%" height="100%"/>
</div>
<div class="col-md-10">
<!--第一行-->
<div class="row" >
<div class="col-md-6" style="height:230px;padding: 0px;">
<img src="../img/middle01.jpg" height="100%" width="100%"/>
</div>
<div class="col-md-2">
<img src="../img/small01.jpg" />
<center><p>豆漿機</p>
<p style="color:red">¥299</p></center>
</div>
<div class="col-md-2">
<img src="../img/small02.jpg" />
<center><p>豆漿機</p>
<p style="color:red">¥299</p></center>
</div>
<div class="col-md-2">
<img src="../img/small03.jpg" />
<center><p>豆漿機</p>
<p style="color:red">¥299</p></center>
</div>
</div>
<!--第一行-->
<div class="row">
<div class="col-md-2">
<img src="../img/small01.jpg" />
<center><p>豆漿機</p>
<p style="color:red">¥299</p></center>
</div>
<div class="col-md-2">
<img src="../img/small02.jpg" />
<center><p>豆漿機</p>
<p style="color:red">¥299</p></center>
</div>
<div class="col-md-2">
<img src="../img/small03.jpg" />
<center><p>豆漿機</p>
<p style="color:red">¥299</p></center>
</div>
<div class="col-md-2">
<img src="../img/small01.jpg" />
<center><p>豆漿機</p>
<p style="color:red">¥299</p></center>
</div>
<div class="col-md-2">
<img src="../img/small02.jpg" />
<center><p>豆漿機</p>
<p style="color:red">¥299</p></center>
</div>
<div class="col-md-2">
<img src="../img/small03.jpg" />
<center><p>豆漿機</p>
<p style="color:red">¥299</p></center>
</div>
</div>
</div>
</div>
</div>
<!--footer部分DIV-->
<div class="row">
<img src="../img/footer.jpg" width="100%"/>
</div>
<!--鏈接及關於我們部分DIV-->
<div class="row">
<center>

    關於我們 聯系我們 招賢納士 法律聲明 友情鏈接 支付方式 配送方式 服務聲明 廣告聲明 <br/>

Copyright ? 2005-2016 傳智商城 版權所有
</center>
</div>
</div>
</body>
</html>

JavaWeb05-HTML篇筆記(三)