使用bootstrap3開(kāi)發(fā)響應(yīng)式網(wǎng)站
本文實(shí)例為大家分享了bootstrap3響應(yīng)式網(wǎng)站開(kāi)發(fā)代碼,供大家參考,具體內(nèi)容如下
第一次使用bootstrap3,發(fā)現(xiàn)對(duì)移動(dòng)支持得不錯(cuò),可以很快的開(kāi)發(fā)出一個(gè)支持移動(dòng)和PC端的網(wǎng)站。
下面就是本文的實(shí)例,具體代碼:
時(shí)間線來(lái)自國(guó)外網(wǎng)站,使用到的css如下
.timeline { list-style: none; padding: 20px 0 20px; position: relative; } .timeline:before { top: 0; bottom: 0; position: absolute; content: " "; width: 3px; background-color: #eeeeee; left: 50%; margin-left: -1.5px; } .timeline > li { margin-bottom: 20px; position: relative; } .timeline > li:before, .timeline > li:after { content: " "; display: table; } .timeline > li:after { clear: both; } .timeline > li:before, .timeline > li:after { content: " "; display: table; } .timeline > li:after { clear: both; } .timeline > li > .timeline-panel { width: 46%; float: left; border: 1px solid #d4d4d4; border-radius: 2px; padding: 20px; position: relative; -webkit-box-shadow: 0 1px 6px rgba(0, 0, 0, 0.175); box-shadow: 0 1px 6px rgba(0, 0, 0, 0.175); } .timeline > li > .timeline-panel:before { position: absolute; top: 26px; right: -15px; display: inline-block; border-top: 15px solid transparent; border-left: 15px solid #ccc; border-right: 0 solid #ccc; border-bottom: 15px solid transparent; content: " "; } .timeline > li > .timeline-panel:after { position: absolute; top: 27px; right: -14px; display: inline-block; border-top: 14px solid transparent; border-left: 14px solid #fff; border-right: 0 solid #fff; border-bottom: 14px solid transparent; content: " "; } .timeline > li > .timeline-badge { color: #fff; width: 50px; height: 50px; line-height: 50px; font-size: 1.4em; text-align: center; position: absolute; top: 16px; left: 50%; margin-left: -25px; background-color: #999999; z-index: 100; border-top-right-radius: 50%; border-top-left-radius: 50%; border-bottom-right-radius: 50%; border-bottom-left-radius: 50%; } .timeline > li.timeline-inverted > .timeline-panel { float: right; } .timeline > li.timeline-inverted > .timeline-panel:before { border-left-width: 0; border-right-width: 15px; left: -15px; right: auto; } .timeline > li.timeline-inverted > .timeline-panel:after { border-left-width: 0; border-right-width: 14px; left: -14px; right: auto; } .timeline-badge.primary { background-color: #2e6da4 !important; } .timeline-badge.success { background-color: #3f903f !important; } .timeline-badge.warning { background-color: #f0ad4e !important; } .timeline-badge.danger { background-color: #d9534f !important; } .timeline-badge.info { background-color: #5bc0de !important; } .timeline-title { margin-top: 0; color: inherit; } .timeline-body > p, .timeline-body > ul { margin-bottom: 0; } .timeline-body > p + p { margin-top: 5px; } @media (max-width: 767px) { ul.timeline:before { left: 40px; } ul.timeline > li > .timeline-panel { width: calc(100% - 90px); width: -moz-calc(100% - 90px); width: -webkit-calc(100% - 90px); } ul.timeline > li > .timeline-badge { left: 15px; margin-left: 0; top: 16px; } ul.timeline > li > .timeline-panel { float: right; } ul.timeline > li > .timeline-panel:before { border-left-width: 0; border-right-width: 15px; left: -15px; right: auto; } ul.timeline > li > .timeline-panel:after { border-left-width: 0; border-right-width: 14px; left: -14px; right: auto; } } <ul class="timeline"> <li> <div class="timeline-badge"><i class="ion-leaf"></i></div> <div class="timeline-panel" style="width: 46%;"> <div class="timeline-heading"> <h4 class="timeline-title">安東尼羅賓·簡(jiǎn)介</h4> <p><small class="text-muted"><i class="glyphicon glyphicon-time"></i></small></p> </div> <div class="timeline-body"> <p>他是一位白手起家事業(yè)成功的億萬(wàn)富翁,是當(dāng)今最成功的世界級(jí)潛能開(kāi)發(fā)專家;他協(xié)助職業(yè)球隊(duì)、企業(yè)總裁、國(guó)家元首激發(fā)潛能,渡過(guò)各種困境及低潮。曾輔導(dǎo)過(guò)多位皇室的家庭成員,被美國(guó)前總統(tǒng)克林頓、戴安娜王妃聘為個(gè)人顧問(wèn);曾為眾多世界名人提供咨詢,包括南非總統(tǒng)曼徳拉、前蘇聯(lián)總統(tǒng)戈?duì)柊蛦谭?、世界網(wǎng)球冠軍安德烈•阿加西等; </p> </div> </div> </li> <li>......................</li> </ul>
做的過(guò)程中發(fā)現(xiàn)Android 4.0 上對(duì)width: -webkit-calc(100% - 90px); 支持得不是很好,時(shí)間線顯示不正常,后來(lái)用JS來(lái)解決了
$(function() { $(window).resize(function() { initTimePanelSize(); }); initTimePanelSize(); function initTimePanelSize(){ width = $(this).width(); //alert(width); if (width <= 767) { $('div.timeline-panel').width($(this).width() - 90); } else { $('div.timeline-panel').css('width', '46%'); } } });
效果圖:
如果大家還想深入學(xué)習(xí),可以點(diǎn)擊這里進(jìn)行學(xué)習(xí),再為大家附兩個(gè)精彩的專題:Bootstrap學(xué)習(xí)教程 Bootstrap實(shí)戰(zhàn)教程
以上就是bootstrap3響應(yīng)式網(wǎng)站關(guān)鍵制作代碼,希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。
- Bootstrap開(kāi)發(fā)實(shí)戰(zhàn)之響應(yīng)式輪播圖
- BootStrap創(chuàng)建響應(yīng)式導(dǎo)航條實(shí)例代碼
- 談一談bootstrap響應(yīng)式布局
- 20分鐘成功編寫bootstrap響應(yīng)式頁(yè)面 就這么簡(jiǎn)單
- BootStrap響應(yīng)式導(dǎo)航條實(shí)例介紹
- Bootstrap每天必學(xué)之響應(yīng)式導(dǎo)航、輪播圖
- Bootstrap實(shí)現(xiàn)響應(yīng)式導(dǎo)航欄效果
- Bootstrap打造一個(gè)左側(cè)折疊菜單的系統(tǒng)模板(二)
- bootstrap布局中input輸入框右側(cè)圖標(biāo)點(diǎn)擊功能
- Bootstrap響應(yīng)式側(cè)邊欄改進(jìn)版
相關(guān)文章
layer設(shè)置maxWidth及maxHeight解決方案
這篇文章主要介紹了layer設(shè)置maxWidth及maxHeight解決方案,非常不錯(cuò),具有一定的參考借鑒價(jià)值 ,需要的朋友可以參考下2019-07-07詳解WordPress開(kāi)發(fā)中g(shù)et_current_screen()函數(shù)的使用
這篇文章主要介紹了WordPress開(kāi)發(fā)中g(shù)et_current_screen()函數(shù)的使用,get_current_screen()通常在對(duì)象的實(shí)例化時(shí)使用,需要的朋友可以參考下2016-01-01Javascript 調(diào)用 ActionScript 的簡(jiǎn)單方法
在Flex中,ActionScript調(diào)用Javascript是比較簡(jiǎn)單的,說(shuō)白了就是,在html里,怎么調(diào)用Javascript,在ActionScript就怎么調(diào)用就可以了。接下來(lái)通過(guò)本文給大家介紹js 調(diào)用 actionscript方法,感興趣的朋友一起看看吧2016-09-09使用AJAX實(shí)現(xiàn)Web頁(yè)面進(jìn)度條的實(shí)例分享
這篇文章主要介紹了使用AJAX實(shí)現(xiàn)Web頁(yè)面進(jìn)度條的實(shí)例分享,利用AJAX的異步來(lái)顯示服務(wù)器端的處理進(jìn)度是當(dāng)下比較流行的做法,需要的朋友可以參考下2016-05-05js中如何對(duì)json數(shù)組進(jìn)行排序
這篇文章主要介紹了js中如何對(duì)json數(shù)組進(jìn)行排序的問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2023-04-04