Bootstrap 学习笔记 项目实战 首页内容介绍 下
最终效果:
HTML代码
<!DOCTYPE html> <html lang="zh-cn"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no"> <title>项目实战</title> <link rel="stylesheet" href="css/bootstrap.min.css"> <link rel="stylesheet" href="css/style.css"> </head> <body> <nav class="navbar navbar-default navbar-fixed-top"> <div class="container"> <div class="navbar-header"> <a href="#" class="navbar-brand logo"><img src="img/logo.png" alt="瓢城企训网"></a> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> </div> <div class="collapse navbar-collapse" id="navbar-collapse"> <ul class="nav navbar-nav navbar-right"> <li class="active"><a href="#"><span class="glyphicon glyphicon-home"></span> 首页</a></li> <li><a href="#"><span class="glyphicon glyphicon-list"></span> 资讯</a></li> <li><a href="#"><span class="glyphicon glyphicon-fire"></span> 案例</a></li> <li><a href="#"><span class="glyphicon glyphicon-question-sign"></span> 关于</a></li> </ul> </div> </div> </nav> <div id="myCarousel" class="carousel slide"> <ol class="carousel-indicators"> <li data-target="#myCarousel" data-slide-to="0" class="active"></li> <li data-target="#myCarousel" data-slide-to="1"></li> <li data-target="#myCarousel" data-slide-to="2"></li> </ol> <div class="carousel-inner"> <div class="item active" style="background:#223240"> <img src="img/slide1.png" alt="第一张"> </div> <div class="item" style="background:#F5E4DC;"> <img src="img/slide2.png" alt="第二张"> </div> <div class="item" style="background:#DE2A2D;"> <img src="img/slide3.png" alt="第三张"> </div> <!-- <div style="background:#eee;"> <img src="img/slide.png" alt="第三张"> </div> --> </div> <a href="#myCarousel" data-slide="prev" class="carousel-control left"> <span class="glyphicon glyphicon-chevron-left"></span> </a> <a href="#myCarousel" data-slide="next" class="carousel-control right"> <span class="glyphicon glyphicon-chevron-right"></span> </a> </div> <div class="tab1"> <div class="container"> <h2 class="tab-h2">「为什么选择瓢城企业培训」</h2> <p class="tab-p">强大的师资力量,完美的实战型管理课程,让您的企业实现质的腾飞!</p> <div class="row"> <div class="col-md-6 col"> <div class="media"> <div class="media-left"> <a href="#"><img src="img/tab1-1.png" class="media-object" alt=""></a> </div> <div class="media-body"> <h4 class="media-heading">课程内容</h4> <p class="text-muted">其他:高校不知名的讲师编写,没有任何实战价值的教材!</p> <p>我们:知名企业家、管理学大师联合编写的具有实现性教材!</p> </div> </div> </div> <div class="col-md-6 col"> <div class="media"> <div class="media-left"> <a href="#"><img src="img/tab1-2.png" class="media-object" alt=""></a> </div> <div class="media-body"> <h4 class="media-heading">师资力量</h4> <p class="text-muted">其他:非欧美正牌大学毕业的、业界没有知名度的讲师!</p> <p>我们:美国哈佛、耶鲁等世界一流高校、享有声誉的名牌专家!</p> </div> </div> </div> <div class="col-md-6 col"> <div class="media"> <div class="media-left"> <a href="#"><img src="img/tab1-3.png" class="media-object" alt=""></a> </div> <div class="media-body"> <h4 class="media-heading">课时安排</h4> <p class="text-muted">其他:无法保证上课效率、没有时间表,任务无法完成!</p> <p>我们:保证按时间表的上课、效率高、当天的任务当天完成!</p> </div> </div> </div> <div class="col-md-6 col"> <div class="media"> <div class="media-left"> <a href="#"><img src="img/tab1-4.png" class="media-object" alt=""></a> </div> <div class="media-body"> <h4 class="media-heading">服务团队</h4> <p class="text-muted">其他:社会招聘的、服务水平参差不齐的普通员工!</p> <p>我们:内部培养、经受过良好高端服务培训的高标准员工!</p> </div> </div> </div> </div> </div> </div> <div class="tab2"> <div class="container"> <div class="row"> <div class="col-md-6 col-sm-6 tab2-img"> <img src="img/tab2.png" class="auto img-responsive center-block" alt=""> </div> <div class="text col-md-6 col-sm-6 tab2-text"> <h3>强大的学习体系</h3> <p>经过管理学大师层层把关、让您的企业突飞猛进。</p> </div> </div> </div> </div> <div class="tab3"> <div class="container"> <div class="row"> <div class="col-md-6 col-sm-6"> <img src="img/tab3.png" class="auto img-responsive center-block" alt=""> </div> <div class="text col-md-6 col-sm-6"> <h3>完美的管理方式</h3> <p>最新的管理培训方案,让您的企业赶超同行。</p> </div> </div> </div> </div> <footer id="footer"> <div class="container"> <p>企业培训 | 合作事宜 | 版权投诉</p> <p>苏ICP 备12345678. © 2009-2016 瓢城企训网. Powered by Bootstrap.</p> </div> </footer> <script src="js/jquery.min.js"></script> <script src="js/bootstrap.min.js"></script> <script type="text/javascript"> $(function () { //轮播自动播放 $('#myCarousel').carousel({ //自动4秒播放 interval : 4000, }); // //设置垂直居中 // $('.carousel-control').css('line-height', $('.carousel-inner img').height() + 'px'); // $(window).resize(function () { // var $height = $('.carousel-inner img').eq(0).height() || // $('.carousel-inner img').eq(1).height() || // $('.carousel-inner img').eq(2).height(); // $('.carousel-control').css('line-height', $height + 'px'); // }); //设置文字垂直居中 $('.text').eq(0).css('margin-top', ($('.auto').eq(0).height() - $('.text').eq(0).height()) / 2 + 'px'); $(window).resize(function () { $('.text').eq(0).css('margin-top', ($('.auto').eq(0).height() - $('.text').eq(0).height()) / 2 + 'px'); }); $('.text').eq(1).css('margin-top', ($('.auto').eq(1).height() - $('.text').eq(1).height()) / 2 + 'px'); $(window).resize(function () { $('.text').eq(1).css('margin-top', ($('.auto').eq(1).height() - $('.text').eq(1).height()) / 2 + 'px'); }); }); </script> </body> </html>
CSS代码:
@charset "utf-8"; body { font-family: "Helvetica Neue", Helvetica, Arial, "Microsoft Yahei UI", "Microsoft YaHei", SimHei, "\5B8B\4F53", simsun, sans-serif; color: #666; } .logo { padding:0; } #myCarousel { margin: 50px 0 0 0; } #navbar-collapse ul { margin-top:0; } .carousel-inner img { margin: 0 auto; } /*.carousel-control { font-size: 100px; }*/ .tab-h2 { font-size: 20px; text-align: center; letter-spacing: 1px; color: #0059b2; } .tab-p { font-size: 15px; text-align: center; letter-spacing: 1px; color: #999; margin: 20px 0 40px 0; } .tab1 { margin: 30px 0; color: #666; } .tab1 .text-muted { color: #999; text-decoration: line-through; } .tab1 .media-heading { margin: 5px 0 20px 0; } .tab1 .col { padding: 20px; } .tab2 { background-color: #eee; padding: 60px 20px; text-align: center; } .tab2 img { width: 40%; height: 40%; } .tab3 { padding: 60px 20px; text-align: center; } .tab3 img { width: 65%; height: 65%; } .text h3 { font-size: 20px; } .text p { font-size: 14px; } #footer { background-color: #eee; border-top: 1px solid #ccc; padding: 20px; text-align: center; } /*没有小于768px,是因为Bootstrap3以移动端优先设计*/ /* 小屏幕(平板,大于等于768px) */ @media (min-width: 768px) { .tab-h2 { font-size: 26px; } .tab-p { font-size: 16px; } .text h3 { font-size: 22px; } .text p { font-size: 15px; } .tab2-text { float: left; } .tab2-img { float: right; } } /* 中等屏幕(桌面显示器,大于等于992px) */ @media (min-width: 992px) { .tab-h2 { font-size: 28px; } .tab-p { font-size: 17px; } .text h3 { font-size: 24px; } .text p { font-size: 16px; } } /* 大屏幕(大桌面显示器,大于等于1200px) */ @media (min-width: 1200px) { .tab-h2 { font-size: 30px; } .tab-p { font-size: 18px; } .text h3 { font-size: 26px; } .text p { font-size: 18px; } }