赞
踩
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <link rel="stylesheet" href="../css/index.css"> </head> <body> <div class="header wrapper"> <h1 class="fl"> <a href="#"><img src="../images/logo.png" alt="logo"></a> </h1> <div class="nav fl"> <ul> <li class="fl"><a href="#">首页</a></li> <li class="fl"><a href="#">课程</a></li> <li class="fl"><a href="#">职业规划</a></li> </ul> </div> <div class="search fl"> <input class="fl" type="text" placeholder="请输入关键字"> <button class="fl"></button> </div> <div class="user fr"> <img src="../images/user.png" alt=""> <span>sleepygod</span> </div> </div> <div class="banner"> <div class="wrapper"> <div class="left fl"> <ul> <li><a href="#">前端开发<span class="fr">></span></a></li> <li><a href="#">后端开发<span class="fr">></span></a></li> <li><a href="#">移动开发<span class="fr">></span></a></li> <li><a href="#">人工智能<span class="fr">></span></a></li> <li><a href="#">商业预测<span class="fr">></span></a></li> <li><a href="#">云计算&大数据<span class="fr">></span></a></li> <li><a href="#">运维&从测试<span class="fr">></span></a></li> <li><a href="#">UI设计<span class="fr">></span></a></li> <li><a href="#">产品<span class="fr">></span></a></li> </ul> </div> <div class="right fr"> <h2>我的课程表</h2> <div class="contect"> <dl> <dt>继续学习 程序设计语言</dt> <dd>正在学习-使用对象</dl> </dl> <dl> <dt>继续学习 程序设计语言</dt> <dd>正在学习-使用对象</dl> </dl> <dl> <dt>继续学习 程序设计语言</dt> <dd>正在学习-使用对象</dl> </dl> </div> <a href="#" class="more">全部课程</a> </div> </div> </div> <div class="fl side-menu clearfix"> <dl> <dd>编程入门</dt> <dd><a href="#">数据分析师</a></dd> <dd><a href="#">机器学习工程师</a></dd> <dd><a href="#">前端开发工程师</a></dd> <dd><a href="#">人工智能工程师</a></dd> <dd><a href="#">全栈工程师</a></dd> <dd><a href="#">iOS工程师</a></dd> <dd><a href="#">VR开发者</a></dd> <dd><a href="#">深度学习</a></dd> <dd><a href="#">商业预测分析师</a></dd> <dd><a href="#">安卓开发工程师</a></dd> </dl> </div> <div class="wrapper goods"> <h2 class="fl">精品推荐</h2> <ul> <li class="fl"> <a href="#">jQuery</a> </li> <li class="fl"> <a href="#">spark</a> </li> <li class="fl"> <a href="#">MySQL</a> </li> <li class="fl"> <a href="#">Javaweb</a> </li> <li class="fl"> <a href="#">JavaScript</a> </li> <li class="fl"> <a href="#">react</a> </li> <li class="fr"> <a href="#">修改兴趣</a> </li> </ul> </div> <div class="wrapper box "> <div class="title"> <h2 class="fl">精品推荐</h2> <a class="fr" href="#">查看全部</a> </div> <div class="contect clearfix"> <ul> <li class="fl"> <a href="#"> <img src="../images/course04.png" alt=""> <h3>Android Hybrid APP开发实战 H5+原生!</h3> <p><span>高级</span> • 1125人在学习</p> </a> </li> <li class="fl"> <a href="#"> <img src="../images/course05.png" alt=""> <h3>UGUI源码深度剖析</h3> <p><span>高级</span> • 1125人在学习</p> </a> </li> <li class="fl"> <a href="#"> <img src="../images/course01.png" alt=""> <h3>Think PHP 5.0 博客系统实战项目演练 </h3> <p><span>高级</span> • 1125人在学习</p> </a> </li> <li class="fl"> <a href="#"> <img src="../images/course07.png" alt=""> <h3>Unity Profiler入门</h3> <p><span>高级</span> • 1125人在学习</p> </a> </li> <li class="fl"> <a href="#"> <img src="../images/course03.png" alt=""> <h3>Angular 2 最新框架+主流技术+项目实战 </h3> <p><span>高级</span> • 1125人在学习</p> </a> </li> <li class="fl"> <a href="#"> <img src="../images/course03.png" alt=""> <h3>Angular 2 最新框架+主流技术+项目实战 </h3> <p><span>高级</span> • 1125人在学习</p> </a> </li> <li class="fl"> <a href="#"> <img src="../images/course08.png" alt=""> <h3>Cocos2d-x 引擎源码中的纹理优化</h3> <p><span>高级</span> • 1125人在学习</p> </a> </li> <li class="fl"> <a href="#"> <img src="../images/course04.png" alt=""> <h3>Android Hybrid APP开发实战 H5+原生!</h3> <p><span>高级</span> • 1125人在学习</p> </a> </li> <li class="fl"> <a href="#"> <img src="../images/course06.png" alt=""> <h3>Kami2首页界面切换效果</h3> <p><span>高级</span> • 1125人在学习</p> </a> </li> <li class="fl"> <a href="#"> <img src="../images/course02.png" alt=""> <h3>Android 网络图片加载框架详解 </h3> <p><span>高级</span> • 1125人在学习</p> </a> </li> </ul> </div> </div> <div class="wrapper box1 "> <div class="title"> <h2 class="fl">数据分析师</h2> <ul> <li class="fl"><a href="#">热门</a></li> <li class="fl"><a href="#">初级</a></li> <li class="fl"><a href="#">中级</a></li> <li class="fl"><a href="#">高级</a></li> </ul> <a class="fr" href="#">查看全部</a> </div> <div class="contect clearfix"> <div class="fl"> <img src="../images/left.jpg" alt=""> </div> <div class="fr"> <div class="boxhead"> <img src="../images/top.jpg" alt=""> </div> <div class="foot"> <ul> <li class="fl"> <a href="#"> <img src="../images/course05.png" alt=""> <h3>UGUI源码深度剖析</h3> <p><span>高级</span> • 1125人在学习</p> </a> </li> <li class="fl"> <a href="#"> <img src="../images/course06.png" alt=""> <h3>Kami2首页界面切换效果</h3> <p><span>高级</span> • 1125人在学习</p> </a> </li> <li class="fl"> <a href="#"> <img src="../images/course07.png" alt=""> <h3>Unity Profiler入门</h3> <p><span>高级</span> • 1125人在学习</p> </a> </li> <li class="fl"> <a href="#"> <img src="../images/course08.png" alt=""> <h3>Cocos2d-x 引擎源码中的纹理优化</h3> <p><span>高级</span> • 1125人在学习</p> </a> </li> </ul> </div> </div> </div> </div> <div class="wrapper box1 "> <div class="title"> <h2 class="fl">编程入门</h2> <ul> <li class="fl"><a href="#">热门</a></li> <li class="fl"><a href="#">初级</a></li> <li class="fl"><a href="#">中级</a></li> <li class="fl"><a href="#">高级</a></li> </ul> <a class="fr" href="#">查看全部</a> </div> <div class="contect clearfix"> <div class="fl"> <img src="../images/left.jpg" alt=""> </div> <div class="fr"> <div class="boxhead"> <img src="../images/top.jpg" alt=""> </div> <div class="foot"> <ul> <li class="fl"> <a href="#"> <img src="../images/course01.png" alt=""> <h3>Think PHP 5.0 博客系统实战项目演练 </h3> <p><span>高级</span> • 1125人在学习</p> </a> </li> <li class="fl"> <a href="#"> <img src="../images/course02.png" alt=""> <h3>Android 网络图片加载框架详解 </h3> <p><span>高级</span> • 1125人在学习</p> </a> </li> <li class="fl"> <a href="#"> <img src="../images/course03.png" alt=""> <h3>Angular 2 最新框架+主流技术+项目实战 </h3> <p><span>高级</span> • 1125人在学习</p> </a> </li> <li class="fl"> <a href="#"> <img src="../images/course04.png" alt=""> <h3>Android Hybrid APP开发实战 H5+原生!</h3> <p><span>高级</span> • 1125人在学习</p> </a> </li> </ul> </div> </div> </div> </div> <div class="box2 wrapper"> <div class="title"> <h2 class="fl">编程入门</h2> <ul> <li class="fl"><a href="#">热门</a></li> <li class="fl"><a href="#">初级</a></li> <li class="fl"><a href="#">中级</a></li> <li class="fl"><a href="#">高级</a></li> </ul> <a class="fr" href="#">查看全部</a> </div> <div class="contect clearfix"> <ul> <li class="fl"> <a href="#"> <img src="../images/course01.png" alt=""> <h3>Think PHP 5.0 博客系统实战项目演练 </h3> <p><span>高级</span> • 1125人在学习</p> </a> </li> <li class="fl"> <a href="#"> <img src="../images/course02.png" alt=""> <h3>Android 网络图片加载框架详解 </h3> <p><span>高级</span> • 1125人在学习</p> </a> </li> <li class="fl"> <a href="#"> <img src="../images/course03.png" alt=""> <h3>Angular 2 最新框架+主流技术+项目实战 </h3> <p><span>高级</span> • 1125人在学习</p> </a> </li> <li class="fl"> <a href="#"> <img src="../images/course04.png" alt=""> <h3>Android Hybrid APP开发实战 H5+原生!</h3> <p><span>高级</span> • 1125人在学习</p> </a> </li> <li class="fl"> <a href="#"> <img src="../images/course06.png" alt=""> <h3>Kami2首页界面切换效果</h3> <p><span>高级</span> • 1125人在学习</p> </a> </li> </ul> </div> </div> <div class="box2 wrapper"> <div class="title"> <h2 class="fl">编程入门</h2> <ul> <li class="fl"><a href="#">热门</a></li> <li class="fl"><a href="#">初级</a></li> <li class="fl"><a href="#">中级</a></li> <li class="fl"><a href="#">高级</a></li> </ul> <a class="fr" href="#">查看全部</a> </div> <div class="contect clearfix"> <ul> <li class="fl"> <a href="#"> <img src="../images/course05.png" alt=""> <h3>UGUI源码深度剖析</h3> <p><span>高级</span> • 1125人在学习</p> </a> </li> <li class="fl"> <a href="#"> <img src="../images/course06.png" alt=""> <h3>Kami2首页界面切换效果</h3> <p><span>高级</span> • 1125人在学习</p> </a> </li> <li class="fl"> <a href="#"> <img src="../images/course07.png" alt=""> <h3>Unity Profiler入门</h3> <p><span>高级</span> • 1125人在学习</p> </a> </li> <li class="fl"> <a href="#"> <img src="../images/course08.png" alt=""> <h3>Cocos2d-x 引擎源码中的纹理优化</h3> <p><span>高级</span> • 1125人在学习</p> </a> </li> <li class="fl"> <a href="#"> <img src="../images/course04.png" alt=""> <h3>Android Hybrid APP开发实战 H5+原生!</h3> <p><span>高级</span> • 1125人在学习</p> </a> </li> </ul> </div> </div> <!-- 清除浮动影响 --> <div class="footer"> <div class="wrapper"> <div class="left fl"> <img src="../images/logo.png" alt=""> <p>学成在线致力于普及中国最好的教育它与中国一流大学和机构合作提供在线课程。 <br> © 2017年XTCG Inc.保留所有权利。-沪ICP备15025210号</p> <a href="#">下载APP</a> </div> <div class="right fr"> <dl class="fl one"> <dt>关于学成网</dt> <dd><a href="#">关于</a></dd> <dd><a href="#">管理团队</a></dd> <dd><a href="#">工作机会</a></dd> <dd><a href="#">客户服务</a></dd> <dd><a href="#">帮助</a></dd> </dl> <dl class="fl"> <dt>新手指南</dt> <dd><a href="#">如何注册</a></dd> <dd><a href="#">如何选课</a></dd> <dd><a href="#">如何拿到毕业证</a></dd> <dd><a href="#">学分是什么</a></dd> <dd><a href="#">考试未通过怎么办</a></dd> </dl> <dl class="fl"> <dt>合作伙伴</dt> <dd><a href="#">合作机构</a></dd> <dd><a href="#">合作导师</a></dd> </dl> </div> </div> </div> </body> </html>
* { margin: 0; padding: 0; box-sizing: border-box; } ul { list-style: none; } a { text-decoration: none; } .fl { float: left; } .fr { float: right; } .clearfix:before, .clearfix:after { content: ""; display: table; } .clearfix:after { clear: both; } body { background-color: #f3f5f7; } /* 版心 */ .wrapper { width: 1200px; margin: 0 auto; } .header { height: 42px; margin: 30px auto; } .nav { height: 42px; margin-left: 70px; } .nav li { margin-right: 26px; } .nav li a { display: inline-block; padding: 0 9px; height: 42px; line-height: 42px; font-size: 18px; color: #050505; } .nav li a:hover { border-bottom: 2px solid #00a4ff; } .header .search { width: 412px; height: 40px; margin-left: 59px; border: 1px solid #00a4ff; } .search input { height: 38px; width: 360px; border: 0; padding-left: 20px; } .search input::placeholder { font-size: 14px; color: #bfbfbf } .search button { width: 50px; height: 40px; background-image: url(../images/btn.png); border: 0; } .header .user { margin-right: 35px; height: 42px; line-height: 42px; } .header .user img { vertical-align: middle; /* 调节图片对齐方式 */ } .banner { height: 420px; background-color: #1c036c; } .banner .wrapper { height: 420px; background-image: url(../images/banner2.png); } .banner .left { width: 190px; height: 420px; padding-left: 21px; padding: 20px; background-color: #000; opacity: 0.3; line-height: 44px; } .banner .left a { font-size: 14px; color: #fff; } .banner .left a:hover { color: #00b4ff; } .banner .right { width: 228px; height: 300px; margin-top: 50px; background-color: #ffffff; } .banner h2 { height: 48px; background-color: #9bceea; line-height: 48px; text-align: center; font-size: 18px; color: #ffffff; } .banner .right .contect { padding: 0 18px; } .banner .right .contect dl { padding: 12px 0; border-bottom: 2px solid #e5e5e5; } .banner .right .contect dl dt { font-size: 16px; color: #4e4e4e; } .banner .right .contect dl dd { font-size: 14px; color: #4e4e4e; } .banner .right .more { display: block; width: 200px; height: 40px; margin: 4px auto 0; border: 2px solid #00a4ff; font-size: 16px; font-weight: bold; text-align: center; line-height: 40px; color: #00a4ff; } .side-menu { width: 150px; height: 520px; background-color: #fff; margin-top: 150px; padding-left: 20px; } .side-menu dd { margin-top: 25px; } .side-menu dd a { font-size: 14px; color: #000; } .side-menu dd a:hover { color: #00a4ff; } .goods { height: 60px; background-color: #fff; margin-top: 8px; box-shadow: 0px 2px 3px 0px rgba(118, 118, 118, 0.2); line-height: 60px; } .goods h2 { width: 132px; padding-left: 34px; font-size: 16px; font-weight: 400; color: #00a4ff; margin-right: 30px; } .goods ul a { font-size: 16px; padding: 0 30px; border-left: 1px solid #bfbfbf; color: #050505; } .goods .fr a { font-size: 14px; color: #00a4ff; } .box { margin-top: 35px; } .box .title { height: 40px; /* padding-right: 30px; */ } .box .title h2 { font-size: 20px; color: #494949; font-weight: 400; } .box .title a { font-size: 12px; color: #a5a5a5; margin-right: 30px; } .box .contect li { width: 228px; height: 270px; margin-right: 15px; margin-bottom: 15px; background-color: #fff; } .box .contect li:nth-child(5n) { margin-right: 0; } .box .contect li h3 { padding: 20px; font-size: 14px; font-weight: 400; color: #050505; } .box .contect li img { width: 228px; } .box .contect li p { font-size: 12px; color: #999999; padding: 0 20px; } .box .contect li p span { font-size: 12px; color: #ff7c2d; } .box1 { margin-top: 35px; } .box1 .title { height: 40px; } .box1 .title h2 { margin-right: 320px; font-size: 20px; color: #494949; } .box1 .title li { margin-right: 70px; } .box1 .title li a { font-size: 16px; color: #868686; } .box1 .title li a:hover { color: #00a4ff; } .box1 .title a { margin-right: 30px; font-size: 12px; color: #a5a5a5; } .box1 .contect .fl { width: 228px; height: 392px; } .box1 .contect .fr { width: 957px; height: 392px; } .box1 .contect .boxhead { margin-bottom: 20px; width: 957px; height: 100px; } .box1 .contect .fr li { width: 228px; height: 270px; margin-right: 15px; background-color: #fff; } .box1 .contect li:nth-child(4) { margin-right: 0; } .box1 .contect li h3 { padding: 20px; font-size: 14px; font-weight: 400; color: #050505; } .box1 .contect li img { width: 228px; } .box1 .contect li p { font-size: 12px; color: #999999; padding: 0 20px; } .box1 .contect li p span { font-size: 12px; color: #ff7c2d; } .box2 { margin-top: 35px; } .box2 .title { height: 40px; } .box2 .title h2 { margin-right: 320px; font-size: 20px; color: #494949; } .box2 .title li { margin-right: 70px; } .box2 .title li a { font-size: 16px; color: #868686; } .box2 .title li a:hover { color: #00a4ff; } .box2 .title a { font-size: 12px; color: #a5a5a5; margin-right: 30px; } .box2 .contect li { width: 228px; height: 270px; margin-right: 15px; margin-bottom: 15px; background-color: #fff; } .box2 .contect li:nth-child(5n) { margin-right: 0; } .box2 .contect li h3 { padding: 20px; font-size: 14px; font-weight: 400; color: #050505; } .box2 .contect li img { width: 228px; } .box2 .contect li p { font-size: 12px; color: #999999; padding: 0 20px; } .box2 .contect li p span { font-size: 12px; color: #ff7c2d; } .footer { height: 417px; background-color: #fff; margin-top: 40px; padding-top: 30px; } .footer .wrapper { padding-right: 35px; } .footer .left p { margin: 25px 0 15PX; font-size: 12px; } .footer .left a { width: 120px; height: 36px; display: block; border: 1px solid #00a4ff; text-align: center; line-height: 36px; font-size: 16px; color: #00a4ff; } .footer .fr dl { margin-left: 100px; } .footer .fr .one { margin-right: 40px; } .footer .fr dl dt { margin-bottom: 15px; font-size: 16px; color: #333; } .footer .fr dl dd { margin-bottom: 5px; } .footer .fr dl dd a { font-size: 12px; color: #333; }
该网页的整体居中,首先建立一个.wrapper的css来控制版心居中样式
对于导航栏部分,利用li嵌套a的形式,因为点击每一个导航栏都会调转到相应网页.
在浮动时,如果浮动不上去需要检查剩余的空间,与所需的空间,大概率是因为css样式设置错误导致,需要f12好好检查css样式.
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。