<!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>学成在线首页</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<!-- 头部区域开始 -->
<div class="headerbox w">
<div class="xclogo"><img src="images/logo.png" alt="logo" /></div>
<!-- <div class="box1 headerbox2inner">首页</div>
<div class="headerbox2">
<span class="headerbox2inner box2">课程</span>
<span class="headerbox2inner box3">职业规划</span>
</div> -->
<!-- 导航栏要写在li里 -->
<ul class="headerbox2">
<li class="flo"><a href="#">首页</a></li>
<li class="flo header2li2"><a href="#">课程</a></li>
<li class="flo"><a href="#">职业规划</a></li>
</ul>
<div class="headerbox3">
<input type="text" placeholder="输入关键词" />
<button><img src="images/fa-search.png" alt="search"></button>
</div>
<div class="headerbox4">
<img src="images/20130502185029_EkKYh拷贝.png" alt="photo">
username
</div>
</div>
<!-- 头部区域结束 -->
<!-- banner部分开始 -->
<div class="bannerbg">
<div class="bannerinner w">
<!-- <div class="bannerleft">
<a href="#">前端开发</a>
<a href="#">后端开发</a>
<a href="#">移动开发</a>
<a href="#">人工智能</a>
<a href="#">商业预测</a>
<a href="#">云计算&大数据</a>
<a href="#">运维&从测试</a>
<a href="#">UI设计</a>
<a href="#">产品</a>
</div> -->
<!-- 上面的做法是不把a放进li里,想使用需要更改css文件里的.bannerleft a -->
<ul class="bannerleft">
<li><a href="#">前端开发<span>></span></a></li>
<li><a href="#">后端开发<span>></span></a></li>
<li><a href="#">移动开发<span>></span></a></li>
<li><a href="#">人工智能<span>></span></a></li>
<li><a href="#">商业预测<span>></span></a></li>
<li><a href="#">云计算&大数据<span>></span></a></li>
<li><a href="#">运维&从测试<span>></span></a></li>
<li><a href="#">UI设计<span>></span></a></li>
<li><a href="#">产品<span>></span></a></li>
</ul>
<div class="bannerright">
<div class="br-top">我的课程表</div>
<div class="br-bottom">
<div class="box">
<span class="bigger">继续学习</span>
<span class="normal">程序语言设计</span>
<div class="smaller">正在学习-使用对象</div>
</div>
<div class="box">
<span class="bigger">继续学习</span>
<span class="normal">程序语言设计</span>
<div class="smaller">正在学习-使用对象</div>
</div>
<div class="box">
<span class="bigger">继续学习</span>
<span class="normal">程序语言设计</span>
<div class="smaller">正在学习-使用对象</div>
</div>
<a href="#">全部课程</a>
</div>
</div>
</div>
</div>
<!-- banner部分结束 -->
<!-- 精品推荐导航栏开始 -->
<div class="w daohang">
<div class="headerbox2inner w">
<ul>
<li class="bold"><a href="#">精品推荐</a></li>
<li><a href="#">JQuery</a></li>
<li><a href="#">Spark</a></li>
<li><a href="#">MySQL</a></li>
<li><a href="#">JavaWeb</a></li>
<li><a href="#">MySQL</a></li>
<li class="javaweb"><a href="#">JavaWeb</a></li>
</ul>
<div class="dhright">
<a href="#">修改兴趣</a>
</div>
</div>
</div>
<!-- 精品推荐导航栏结束 -->
<div class="w bg">
<h3 class="flo">精品推荐</h3>
<div class="jingpinright"><a href="#">查看全部</a></div>
</div>
<!-- 精品推荐主体开始 -->
<div class="tuijian w">
<a href="#" class="jingpininner">
<div class="jpbox-top"><img src="images/图层 135.png" alt="image"></div>
<div class="jpbox-bottom">
<p>Think PHP 5.0 博客系统实战项目演练</p>
<div class="jpbox-bottom2">
<span class="span1">高级 </span>
<span class="span2"> · </span>
<span class="span3">1125人正在学习</span>
</div>
</div>
</a>
<a href="#" class="jingpininner">
<div class="jpbox-top"><img src="images/图层 135.png" alt="image"></div>
<div class="jpbox-bottom">
<p>Think PHP 5.0 博客系统实战项目演练</p>
<div class="jpbox-bottom2">
<span class="span1">高级 </span>
<span class="span2"> · </span>
<span class="span3">1125人正在学习</span>
</div>
</div>
</a>
<a href="#" class="jingpininner">
<div class="jpbox-top"><img src="images/图层 135.png" alt="image"></div>
<div class="jpbox-bottom">
<p>Think PHP 5.0 博客系统实战项目演练</p>
<div class="jpbox-bottom2">
<span class="span1">高级 </span>
<span class="span2"> · </span>
<span class="span3">1125人正在学习</span>
</div>
</div>
</a>
<a href="#" class="jingpininner">
<div class="jpbox-top"><img src="images/图层 135.png" alt="image"></div>
<div class="jpbox-bottom">
<p>Think PHP 5.0 博客系统实战项目演练</p>
<div class="jpbox-bottom2">
<span class="span1">高级 </span>
<span class="span2"> · </span>
<span class="span3">1125人正在学习</span>
</div>
</div>
</a>
<a href="#" class="jpright">
<div class="jpbox-top"><img src="images/图层 135.png" alt="image"></div>
<div class="jpbox-bottom">
<p>Think PHP 5.0 博客系统实战项目演练</p>
<div class="jpbox-bottom2">
<span class="span1">高级 </span>
<span class="span2"> · </span>
<span class="span3">1125人正在学习</span>
</div>
</div>
</a>
<a href="#" class="jingpininner">
<div class="jpbox-top"><img src="images/图层 135.png" alt="image"></div>
<div class="jpbox-bottom">
<p>Think PHP 5.0 博客系统实战项目演练</p>
<div class="jpbox-bottom2">
<span class="span1">高级 </span>
<span class="span2"> · </span>
<span class="span3">1125人正在学习</span>
</div>
</div>
</a>
<a href="#" class="jingpininner">
<div class="jpbox-top"><img src="images/图层 135.png" alt="image"></div>
<div class="jpbox-bottom">
<p>Think PHP 5.0 博客系统实战项目演练</p>
<div class="jpbox-bottom2">
<span class="span1">高级 </span>
<span class="span2"> · </span>
<span class="span3">1125人正在学习</span>
</div>
</div>
</a>
<a href="#" class="jingpininner">
<div class="jpbox-top"><img src="images/图层 135.png" alt="image"></div>
<div class="jpbox-bottom">
<p>Think PHP 5.0 博客系统实战项目演练</p>
<div class="jpbox-bottom2">
<span class="span1">高级 </span>
<span class="span2"> · </span>
<span class="span3">1125人正在学习</span>
</div>
</div>
</a>
<a href="#" class="jingpininner">
<div class="jpbox-top"><img src="images/图层 135.png" alt="image"></div>
<div class="jpbox-bottom">
<p>Think PHP 5.0 博客系统实战项目演练</p>
<div class="jpbox-bottom2">
<span class="span1">高级 </span>
<span class="span2"> · </span>
<span class="span3">1125人正在学习</span>
</div>
</div>
</a>
<a href="#" class="jpright">
<div class="jpbox-top"><img src="images/图层 135.png" alt="image"></div>
<div class="jpbox-bottom">
<p>Think PHP 5.0 博客系统实战项目演练</p>
<div class="jpbox-bottom2">
<span class="span1">高级 </span>
<span class="span2"> · </span>
<span class="span3">1125人正在学习</span>
</div>
</div>
</a>
</div>
<!-- 精品推荐主体结束 -->
<!-- footer below -->
<div class="footer clear">
<div class="w">
<div class="footerright">
<dl>
<div class="rightpart">
<dt>合作伙伴</dt>
<dd><a href="#">合作机构</a></dd>
<dd><a href="#">合作导师</a></dd>
</div>
<div class="rightpart">
<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>
</div>
<div class="rightpart">
<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>
</div>
</dl>
</div>
<div class="footerleft">
<ul>
<li><img src="images/学成在线.png" alt=""></li>
<li class="zi">学成在线致力于普及中国最好的教育它与中国一流大学和机构合作提供在线课程。<br>
© 2017年XTCG Inc.保留所有权利。-沪ICP备15025210号</li>
<li class="underzi"><a href="#">下载APP</a></li>
</ul>
</div>
</div>
</div>
</body>
</html>
以上是html文件。
* {
padding: 0;
margin: 0;
}
a {
text-decoration: none;
color: black;
}
li {
list-style: none;
}
.w {
width: 1200px;
margin: 0px auto;
}
body {
background-color: #f3f5f7;
}
.headerbox {
height: 42px;
/* background-color: grey; */
margin: 30px auto;
/* background: transparent url(images/logo.png) no-repeat scroll left; */
}
.xclogo img {
float: left;
/* display: ; */
height: 42px;
width: 200px;
/* margin: 0px auto; */
}
.headerbox2 {
float: left;
/* width: 252px; */
height: 42px;
line-height: 42px;
margin: 0px 66px;
/* background-color: pink; */
font-size: 18px;
}
.headerbox2 li a {
display: inline-block;
height: 42px;
padding: 0px 10px;
}
.headerbox2 li a:hover {
border-bottom: 2px #00a4ff solid;
}
.flo {
float: left;
/* padding: 0px 10px; */
}
.header2li2 {
margin: 0px 25px;
}
.headerbox2inner {
padding: 0px 10px;
}
.box1 {
float: left;
height: 42px;
width: 36px;
line-height: 42px;
margin-left: 66px;
border-bottom: 2px #00a4ff solid;
font-size: 18px;
/* background-color: pink; */
}
.box2 {
margin: 0px 25px;
}
.box3 {
margin: 0px 20px 0px 0px;
}
.headerbox3 {
float: left;
width: 411px;
height: 40px;
}
.headerbox3 input {
float: left;
width: 345px;
height: 40px;
border: 1px #00a4ff solid;
border-right: 0px;
padding-left: 15px;
outline: none;
}
.headerbox3 button {
float: left;
width: 50px;
height: 42px;
background-color: #00a4ff;
border: none;
/* background-image: url(images/fa-search.png); */
}
.headerbox4 {
float: right;
height: 42px;
line-height: 42px;
/* margin-right: 30px; */
font-size: 14px;
color: #666;
}
.bannerleft {
/* margin: 0px auto 0px 0px; */
float: left;
width: 151px;
height: 420px;
padding: 0px 20px;
line-height: 46px;
font-size: 14px;
background-color: rgb(0, 0, 0, .3);
}
.bannerleft a {
display: block;
height: 46px;
width: 151px;
/* 错误注释:上面的三行代码如果html文件里a是放在li里的则不用写,否则去掉会使几个a标签里的字挤在一起 */
/* 正确注释:上面的三行代码的作用是使得a标签所在的一整个框都能用鼠标点击,不管有没有li都要加上 */
/* line-height: 46px;
font-size: 14px; */
/* 上面2行代码可以直接放进.bannerleft里 */
color: white;
}
.bannerleft a span {
float: right;
}
.bannerleft a:hover {
color: #00b4ff;
}
.bannerbg {
height: 420px;
background: #1c036c url(images/banner2.png) no-repeat scroll top;
}
.bannerinner {
height: 420px;
/* background-color: red; */
}
.bannerright {
float: right;
height: 300px;
width: 228px;
margin: 50px 0px 70px;
background-color: white;
}
.br-top {
height: 48px;
/* width: 228px; */
/* 由于宽度有bannerright限制,所以上面这句话可以不写 */
background-color: #9bceea;
color: white;
font: 700 18px 'Microsoft YaHei';
line-height: 48px;
text-align: center;
letter-spacing: 2px;
/* 以上这行代码没讲,用处是设置字间距为2px */
}
.br-bottom {
height: 252px;
width: 200px;
/* margin: auto; */
padding: 0px 20px;
/* background-color: red; */
}
.br-bottom .box {
padding: 14px 0px;
border-bottom: 1px solid #eaeaea;
}
.bigger {
font-size: 16px;
font-weight: 500;
color: #4e4e4e;
}
.normal {
font-size: 14px;
font-weight: 500;
color: #4e4e4e;
}
.smaller {
font-size: 12px;
font-weight: 500;
color: #a5a5a5;
}
.br-bottom a {
display: block;
margin: 5px auto;
height: 38px;
/* width: 200px; */
line-height: 38px;
text-align: center;
border: 1px solid #22b0ff;
color: #22b0ff;
font-size: 16px;
font-weight: 700;
}
.daohang {
height: 60px;
font-size: 16px;
margin: 8px auto 35px auto;
background-color: #ffffff;
box-shadow: 0px 2px 3px 3px rgb(0, 0, 0, .1);
/* margin: ; */
}
.daohang .headerbox2inner {
height: 16px;
padding-top: 21px;
/* background-color: pink; */
}
.daohang ul a {
float: left;
padding: 0 37px;
border-right: 1px #bfbfbf solid;
}
.daohang ul .bold a {
font-weight: 700;
color: #00a4ff;
}
.daohang ul .javaweb a {
border-right: 0px;
}
.daohang ul a:hover {
color: #00a4ff;
}
.daohang .dhright a {
float: right;
font-size: 14px;
padding-right: 26px;
color: #00a4ff;
}
.jingpinright {
float: right;
font-size: 12px;
color: #a5a5a5;
padding-right: 30px;
margin-top: 10px;
}
.tuijian {
/* background-color: pink; */
padding-top: 10px;
}
.bg {
height: 30px;
}
.jingpininner {
float: left;
width: 228px;
height: 270px;
background-color: white;
margin: 0px 15px 15px 0px;
}
.jpright {
float: left;
width: 228px;
height: 270px;
background-color: white;
margin-bottom: 15px;
}
.jingpininner .jpbox-top {
height: 154px;
width: 228px;
/* background-color: blue; */
/* background: white scroll no-repeat url(images/图层\ 135.png); */
}
.jpbox-top img {
width: 100%;
}
.tuijian a:hover {
box-shadow: 0 2px 3px 3px rgb(0, 0, 0, .1);
}
.jpbox-bottom {
width: 228px;
background-color: white;
}
.jpbox-bottom p {
display: block;
margin: 25px 20px 20px 25px;
font-size: 14px;
color: #050505;
font-weight: 500;
}
.jpbox-bottom2 .span1 {
margin-left: 25px;
color: #ff7c2d;
font-size: 12px;
}
.jpbox-bottom2 .span2 {
color: #999999;
font-weight: 700;
}
.jpbox-bottom2 .span3 {
font-size: 12px;
color: #999999;
}
.footer {
float: left;
height: 418px;
width: 100%;
margin-top: 20px;
background-color: #fff;
}
.clear {
clear: both;
}
.footerleft {
width: 600px;
height: 200px;
margin: 30px 20px;
/* background-color: pink; */
}
.footerleft ul .zi {
font-size: 12px;
color: #666666;
margin-top: 25px;
}
.footerleft .underzi a {
display: inline-block;
width: 118px;
height: 35px;
line-height: 35px;
text-align: center;
margin-top: 20px;
color: #00a4ff;
border: 1px #00a4ff solid;
}
.footerright {
float: right;
margin-right: 32px;
}
.footerright .rightpart {
float: right;
margin-left: 120px;
}
.footerright dt {
font-size: 16px;
}
.footerright dd {
font-size: 12px;
}
.rightpart dt,
dd {
line-height: 21px;
}
以上是css文件。
效果图:
其中主体部分由于重复性较高所以不全部写出来,下面是补充的主体部分的另一个模板:
下面是该模板的html文件:
<!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="style.css">
</head>
<body>
<div class="box">
<div class="left">
<img src="images/椭圆 6 拷贝 16.png" alt="">
</div>
<div class="top">
<img src="images/图层 155.png" alt="">
</div>
<div class="bottom">
<a href="#" class="jingpininner">
<div class="jpbox-top"><img src="images/图层 135.png" alt="image"></div>
<div class="jpbox-bottom">
<p>Think PHP 5.0 博客系统实战项目演练</p>
<div class="jpbox-bottom2">
<span class="span1">高级 </span>
<span class="span2"> · </span>
<span class="span3">1125人正在学习</span>
</div>
</div>
</a>
<a href="#" class="jingpininner">
<div class="jpbox-top"><img src="images/图层 135.png" alt="image"></div>
<div class="jpbox-bottom">
<p>Think PHP 5.0 博客系统实战项目演练</p>
<div class="jpbox-bottom2">
<span class="span1">高级 </span>
<span class="span2"> · </span>
<span class="span3">1125人正在学习</span>
</div>
</div>
</a>
<a href="#" class="jingpininner">
<div class="jpbox-top"><img src="images/图层 135.png" alt="image"></div>
<div class="jpbox-bottom">
<p>Think PHP 5.0 博客系统实战项目演练</p>
<div class="jpbox-bottom2">
<span class="span1">高级 </span>
<span class="span2"> · </span>
<span class="span3">1125人正在学习</span>
</div>
</div>
</a>
<a href="#" class="jingpininner">
<div class="jpbox-top"><img src="images/图层 135.png" alt="image"></div>
<div class="jpbox-bottom">
<p>Think PHP 5.0 博客系统实战项目演练</p>
<div class="jpbox-bottom2">
<span class="span1">高级 </span>
<span class="span2"> · </span>
<span class="span3">1125人正在学习</span>
</div>
</div>
</a>
</div>
</div>
</body>
</html>
上面这个模板调用的style有部分被删除了,相信解决了最前面代码的所有问题的读者应该不需要在上面这个模板上花太多功夫,如果实在想做却做不出来,欢迎私信联系。