Class(2017-1)練習1

七、【 navbar 導覽列】區塊

BS:【元件Components】>【巡覽列Navbar】

BS:【CSS】>【表單Forms】

確認項目:

1.CSS:【CSS】>【格線系統Grid system】

2.加入【品牌圖片  .navbar-brand】、【固定至頂端.navbar-fixed-top】、【元件對齊.navbar-left】
、【固定至底端.navbar-fixed-bottom】、【反向顏色.navbar-inverse】

3.【CSS】>【表單Forms】

7-1 導覽列及表單 結構 加入

原始

結構

7-1-1  navbar 導覽列 BS 貼入

BS:【元件Components】>【巡覽列Navbar】

<!-- navbar 導覽列 ================================================================= -->
<nav class="navbar navbar-default">
    <div class="container">
        <!-- 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="#"><img src="images/logo.png" alt="Gjun Class"></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="#">首頁</li>
                <li><a href="#">開課查詢</a></li>
                <li class="dropup">
                    <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>
                <li class="dropup">
                    <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>
                <li><a href="#">全國分校</a></li>
                <li><a href="#">學員專區</a></li>
            </ul>

        </div>
        <!-- /.navbar-collapse -->
    </div>
    <!-- /.container-fluid -->
</nav>

7-1-2  search form 表單 BS貼入修改

BS:【CSS】>【表單Forms】

<!-- search form ================================================================= -->
<div class="container">
   <form class="navbar-form form-inline  text-center">
               <span>課程搜尋</span>
               <select name="" id="" class="form-control">
                   <option value="1">北區開課查詢</option>
                   <option value="2">中區開課查詢</option>
                   <option value="3">南區開課查詢</option>
                   <option value="4">東區開課查詢</option>
                   <option value="5">熱門文章搜尋</option>
               </select>
                <div class="form-group">
                    <input type="text" class="form-control" placeholder="Search">
                </div>
                <button type="submit" class="btn btn-default">
                    <span class="glyphicon glyphicon-search" aria-hidden="true"></span>
                </button>
    </form> 
</div>

7-2  導覽列及表單 CSS美化

結果顯示

 

/*navbar 導覽列========================================================================*/
.navbar-brand { padding: 7px 15px 0;}

.navbar{ background:url(images/navbg.jpg); }
.navbar-default .navbar-nav > li > a { color: #fff;}
.navbar-default .navbar-nav > li > a:hover ,.navbar-default .navbar-nav > li > a:focus{
    color: #ffeb01;
}
.navbar-default .navbar-nav > .active > a {color: #fff;  background: #5d0000;}
.navbar-default { border: none; }