欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Bootstrap前端開(kāi)發(fā)案例一

 更新時(shí)間:2016年06月17日 15:16:11   作者:rongyux  
Bootstrap前端開(kāi)發(fā)案例一,這篇文章能夠幫助大家更還好的進(jìn)行前端開(kāi)發(fā)Bootstrap,相信大家會(huì)愛(ài)上Bootstrap

現(xiàn)在很多公司開(kāi)發(fā)中都在使用bootstrap這個(gè)框架,bootstrap是Twitter公司的一個(gè)團(tuán)隊(duì)的作品,大大簡(jiǎn)化了我們的前端的開(kāi)發(fā)。(后面會(huì)總結(jié)一些less的使用)
學(xué)習(xí)使用API我建議直接查看官網(wǎng)的API,地址:http://www.bootcss.com/
下面是部分目標(biāo)效果圖:

下面我就總結(jié)一個(gè)小Demo中的技巧和原理:
第一步、http://www.bootcss.com/下載bootstrap的壓縮包,新建index.html,使用sublime或其它編輯器打開(kāi)index頁(yè)面,解壓后目錄是

 

第二步、拷貝官網(wǎng)http://v3.bootcss.com/getting-started/的一個(gè)基本模板,方便后續(xù)的開(kāi)發(fā),

<!DOCTYPE html>
<html lang="zh-CN">
 <head>
 <meta charset="utf-8">
 <meta http-equiv="X-UA-Compatible" content="IE=edge">
 <meta name="viewport" content="width=device-width, initial-scale=1">
 <!-- 上述3個(gè)meta標(biāo)簽*必須*放在最前面,任何其他內(nèi)容都*必須*跟隨其后! -->
 <title>Bootstrap 101 Template</title>

 <!-- Bootstrap -->
 <link href="css/bootstrap.min.css" rel="stylesheet">

 <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
 <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
 <!--[if lt IE 9]>
 <script src="http://cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
 <script src="http://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
 <![endif]-->
 </head>
 <body>
 <h1>你好,世界!</h1>

 <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
 <script src="http://cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script>
 <!-- Include all compiled plugins (below), or include individual files as needed -->
 <script src="js/bootstrap.min.js"></script>
 </body>
</html> 

1)、注意:jquery.js的引用一定要在bootstrap.min.js的前面,并且最好手動(dòng)下載一個(gè)jquery.js,放在js路徑下,<script src="js/jquery.min.js"></script>
 因?yàn)楹髞?lái)我在仿真的時(shí)候發(fā)現(xiàn)下拉和carousel的動(dòng)畫(huà)效果都沒(méi)有了,發(fā)現(xiàn)基本模板的jquery文件是下載的,可能沒(méi)有聯(lián)網(wǎng),所以沒(méi)有下載下來(lái),最好自己引用本地。
  2)、注意:css引用放頁(yè)面上方,js引用放頁(yè)面下方,因?yàn)閏ss需要先加載渲染頁(yè)面,而js需要在頁(yè)面渲染完畢后加載執(zhí)行;并且適應(yīng)移動(dòng)設(shè)備的meta語(yǔ)句:<meta name="viewport" content="width=device-width, initial-scale=1">

第三步、導(dǎo)航條
1)居中效果:container-fluent需要改成container 
2)白色改成反差效果的黑色: <nav class="navbar navbar-default navbar-inverse"> 
3)導(dǎo)航條固定到頂部,增加時(shí)類(lèi)屬性: navbar-fixed-top 

 <nav class="navbar navbar-default navbar-fixed-top navbar-inverse ">
 <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="#">瘋狂動(dòng)物城</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="#">首頁(yè) <span class="sr-only">(current)</span></a></li>
 <li><a href="#">簡(jiǎn)述</a></li>
 <li><a href="#">特點(diǎn)</a></li>
 <li><a href="#">關(guān)于</a></li> 
 
 </div><!-- /.navbar-collapse -->
 </div><!-- /.container-fluid -->
 </nav> 

4)導(dǎo)航條會(huì)遮蓋body的頂部,所以增加樣式

<style type="text/css"> 
 body{
 padding-top: 50px;
 } 
 </style> 

5)特點(diǎn)的導(dǎo)航項(xiàng)目增加下拉菜單 

<li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">特點(diǎn)</a>
 <ul class="dropdown-menu">
 <li><a href="#">動(dòng)物1</a></li>
 <li><a href="#">動(dòng)物2</a></li>
 <li><a href="#">動(dòng)物3</a></li>
 <li><a href="#">動(dòng)物4</a></li>
 </ul>
 </li>

注意,子菜單的內(nèi)容均嵌套在最外層的li標(biāo)簽里,并且li標(biāo)簽有類(lèi) dropdown,子菜單也是一個(gè)ul標(biāo)簽,類(lèi)為dropdown-menu,具體映射關(guān)系見(jiàn)上面。

第四步、增加輪轉(zhuǎn)效果,復(fù)制修改bootstrap組件的carousel模塊:

<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>
 </ol>

 <!-- Wrapper for slides -->
 <div class="carousel-inner" role="listbox">
 <div class="item active">
 <img src="image/1.jpg" alt="...">
 <div class="carousel-caption">
 <h1>瘋狂動(dòng)物城1</h1>
 <p>來(lái)擴(kuò)大感受到的女生看房名卡位的訪(fǎng)問(wèn)怒法師開(kāi)門(mén)了國(guó)家發(fā)生的兩個(gè)號(hào)</p>
 </div>
 </div>
 <div class="item">
 <img src="image/2.jpg" alt="...">
 <div class="carousel-caption">
 <h1>瘋狂動(dòng)物城1</h1>     <p>來(lái)擴(kuò)大感受到的女生看房名卡位的訪(fǎng)問(wèn)怒法師開(kāi)門(mén)了國(guó)家發(fā)生的兩個(gè)號(hào)</p>
 </div>
 </div>
 <div class="item">
 <img src="image/3.jpg" alt="...">
 <div class="carousel-caption">
 <h1>瘋狂動(dòng)物城1</h1>     <p>來(lái)擴(kuò)大感受到的女生看房名卡位的訪(fǎng)問(wèn)怒法師開(kāi)門(mén)了國(guó)家發(fā)生的兩個(gè)號(hào)</p>
 </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">上一頁(yè)</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">下一頁(yè)</span>
 </a>
 </div> 

1)為了輪轉(zhuǎn)圖片的時(shí)候沒(méi)有留白或間隙,增加樣式 

 .carousel{
 height: 500px;
 background-color: #000;
 }

 .carousel .item{
 height: 500px;
 background-color: #000;
 } .carousel img{ width: 100%; } 

2)為了文字設(shè)置樣式,更加美觀(guān)

 .casousel-caption p{
 margin-bottom: 20px;
 font-size: 20px;
 line-height: 1.8;
 } 

目前的效果如下


 咱們繼續(xù):(打碼更新中。。。) 
第二部分更新了,在基于bootstrap的前端開(kāi)發(fā)案例Demo(二) 

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

如果大家還想深入學(xué)習(xí),可以點(diǎn)擊這里進(jìn)行學(xué)習(xí),再為大家附一個(gè)精彩的專(zhuān)題:Bootstrap學(xué)習(xí)教程

相關(guān)文章

  • 微信小程序中slot插槽基本使用方法實(shí)例

    微信小程序中slot插槽基本使用方法實(shí)例

    之前竟然聽(tīng)到有人跟我說(shuō)微信小程序沒(méi)有組件插槽功能,下面這篇文章主要給大家介紹了關(guān)于微信小程序中slot插槽基本使用方法的相關(guān)資料,文中通過(guò)實(shí)例代碼介紹的非常詳細(xì),需要的朋友可以參考下
    2022-11-11
  • js添加事件的通用方法推薦

    js添加事件的通用方法推薦

    下面小編就為大家?guī)?lái)一篇js添加事件的通用方法推薦。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2016-05-05
  • JavaScript設(shè)計(jì)模式之建造者模式介紹

    JavaScript設(shè)計(jì)模式之建造者模式介紹

    這篇文章主要介紹了JavaScript設(shè)計(jì)模式之建造者模式介紹,將一個(gè)復(fù)雜對(duì)象的構(gòu)造與它的表示相分離,使同樣的創(chuàng)建過(guò)程可有不同的表示,這就叫做建造者模式,需要的朋友可以參考下
    2014-12-12
  • ES5新增數(shù)組的實(shí)現(xiàn)方法

    ES5新增數(shù)組的實(shí)現(xiàn)方法

    這篇文章主要介紹了ES5新增數(shù)組的實(shí)現(xiàn)方法,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2020-05-05
  • 微信小程序生成海報(bào)分享朋友圈的實(shí)現(xiàn)方法

    微信小程序生成海報(bào)分享朋友圈的實(shí)現(xiàn)方法

    利用微信強(qiáng)大的社交能力通過(guò)小程序達(dá)到裂變的目的,拉取新用戶(hù)。下面小編給大家?guī)?lái)了微信小程序生成海報(bào)分享朋友圈的實(shí)現(xiàn)方法,感興趣的朋友跟隨小編一起看看吧
    2019-05-05
  • JS實(shí)現(xiàn)的點(diǎn)擊按鈕圖片上下滾動(dòng)效果示例

    JS實(shí)現(xiàn)的點(diǎn)擊按鈕圖片上下滾動(dòng)效果示例

    這篇文章主要介紹了JS實(shí)現(xiàn)的點(diǎn)擊按鈕圖片上下滾動(dòng)效果,涉及javascript事件響應(yīng)及頁(yè)面元素屬性動(dòng)態(tài)操作相關(guān)實(shí)現(xiàn)技巧,需要的朋友可以參考下
    2019-01-01
  • javascript 偽數(shù)組實(shí)現(xiàn)方法

    javascript 偽數(shù)組實(shí)現(xiàn)方法

    能通過(guò)Array.prototype.slice轉(zhuǎn)換為真正的數(shù)組的帶有l(wèi)ength屬性的對(duì)象。
    2010-10-10
  • canvas知識(shí)總結(jié)

    canvas知識(shí)總結(jié)

    本文主要介紹了canvas的相關(guān)知識(shí)。具有很好的參考價(jià)值,下面跟著小編一起來(lái)看下吧
    2017-01-01
  • js實(shí)現(xiàn)表單檢測(cè)及表單提示的方法

    js實(shí)現(xiàn)表單檢測(cè)及表單提示的方法

    這篇文章主要介紹了js實(shí)現(xiàn)表單檢測(cè)及表單提示的方法,涉及javascript表單元素提示效果的相關(guān)技巧,非常簡(jiǎn)單實(shí)用,需要的朋友可以參考下
    2015-08-08
  • JS實(shí)現(xiàn)鼠標(biāo)滑過(guò)鏈接改變網(wǎng)頁(yè)背景顏色的方法

    JS實(shí)現(xiàn)鼠標(biāo)滑過(guò)鏈接改變網(wǎng)頁(yè)背景顏色的方法

    這篇文章主要介紹了JS實(shí)現(xiàn)鼠標(biāo)滑過(guò)鏈接改變網(wǎng)頁(yè)背景顏色的方法,涉及js響應(yīng)鼠標(biāo)事件動(dòng)態(tài)修改頁(yè)面元素屬性的實(shí)現(xiàn)技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下
    2015-10-10

最新評(píng)論