学成在线页面复刻
在b站学习“pink老师前端入门教程”,模仿学成在线主页。小白一枚才开始学前端没多久,感觉对于新手而言制作这种页面可以一个模块一个模块的做,大盒子包着小盒子,之后逐步细化。按照这种思路会更加清晰
页面效果
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="index.css">
</head>
<body>
<!-- 头部 -->
<div class="header w">
<div class="logo">
<img src="imge/logo.png" alt="">
</div>
<div class="nav">
<ul>
<li><a href="#">首页</a></li>
<li><a href="#">课程</a></li>
<li><a href="#">职业规划</a></li>
</ul>
</div>
<!-- 搜索 -->
<div class="search">
<input type="text" value="请输入文字">
<button></button>
</div>
<div class="user">
<img src="imge/user.png" alt="">
qq.lilei
</div>
</div>
<!-- 测导航栏 课程 -->
<div class="banner">
<div class="center w">
<div class="subnav">
<ul>
<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="#">前端开发<span> > </span></a></li>
<li><a href="#">后端开发<span> > </span></a></li>
</ul>
</div>
<div class="course">
<h2>我的课程表</h2>
<div class="study">
<ul>
<li>
<h4>继续学习 程序语言设计</h4>
<p>正在学习</p>
</li>
<li>
<h4>继续学习 程序语言设计</h4>
<p>正在学习</p>
</li>
<li>
<h4>继续学习 程序语言设计</h4>
<p>正在学习</p>
</li>
</ul>
<a href="#" class="more">全部课程</a>
</div>
<!-- <div class="allclass"></div> -->
</div>
</div>
</div>
<!-- 兴趣 -->
<div class="goods w">
<h4>精品推荐</h4>
<ul>
<li><span> | </span><a href="#">JQuery</a></li>
<li><span> | </span><a href="#">Spark</a></li>
<li><span> | </span><a href="#">MySQL</a></li>
<li><span> | </span><a href="#">JQuerr</a></li>
<li><span> | </span><a href="#">MySQL</a></li>
<li><span> | </span><a href="#">Spark</a></li>
</ul>
<a href="#">修改兴趣</a>
</div>
<!-- 精品推荐大盒子 -->
<div class="box w">
<div class="box-hd">
<h4>精品推荐</h4>
<a href="#">查看更多</a>
</div>
<div class="box-bd clearfix">
<ul>
<li>
<img src="imge/pic.png" alt="">
<h4>Think PHP 5.0 博客系统实战项目演练</h4>
<div class="title">
<span>高级</span> • 1125人在学习
</div>
</li>
<li>
<img src="imge/pic.png" alt="">
<h4>Think PHP 5.0 博客系统实战项目演练</h4>
<div class="title">
<span>高级</span> • 1125人在学习
</div>
</li>
<li>
<img src="imge/pic.png" alt="">
<h4>Think PHP 5.0 博客系统实战项目演练</h4>
<div class="title">
<span>高级</span> • 1125人在学习
</div>
</li>
<li>
<img src="imge/pic.png" alt="">
<h4>Think PHP 5.0 博客系统实战项目演练</h4>
<div class="title">
<span>高级</span> • 1125人在学习
</div>
</li>
<li class="last">
<img src="imge/pic.png" alt="">
<h4>Think PHP 5.0 博客系统实战项目演练</h4>
<div class="title">
<span>高级</span> • 1125人在学习
</div>
</li>
<li>
<img src="imge/pic.png" alt="">
<h4>Think PHP 5.0 博客系统实战项目演练</h4>
<div class="title">
<span>高级</span> • 1125人在学习
</div>
</li>
<li>
<img src="imge/pic.png" alt="">
<h4>Think PHP 5.0 博客系统实战项目演练</h4>
<div class="title">
<span>高级</span> • 1125人在学习
</div>
</li>
<li>
<img src="imge/pic.png" alt="">
<h4>Think PHP 5.0 博客系统实战项目演练</h4>
<div class="title">
<span>高级</span> • 1125人在学习
</div>
</li>
<li>
<img src="imge/pic.png" alt="">
<h4>Think PHP 5.0 博客系统实战项目演练</h4>
<div class="title">
<span>高级</span> • 1125人在学习
</div>
</li>
<li class="last">
<img src="imge/pic.png" alt="">
<h4>Think PHP 5.0 博客系统实战项目演练</h4>
<div class="title">
<span>高级</span> • 1125人在学习
</div>
</li>
</ul>
</div>
</div>
<!-- 编程入门 -->
<div class="code w">
<div class="code-hd">
<h4>编程入门</h4>
<div class="code-hd-center">
<ul>
<li><a href="#">热门</a></li>
<li><a href="#">热门</a></li>
<li><a href="#">热门</a></li>
<li><a href="#">热门</a></li>
</ul>
</div>
<a href="#" class="more">查看更多</a>
</div>
<div class="code-bd">
<div class="bd-left">
<img src="imge/椭圆 6 拷贝 16.png" alt="">
</div>
<div class="bd-right">
<div class="bd-hd">
<img src="imge/快乐编程.png" alt="">
</div>
<div class="bd-main">
<ul>
<li>
<img src="imge/课程.png" alt="">
<h4>Android Hybrid APP开发实战 H5+原生!</h4>
<div class="title">
<span>高级</span> • 1125人在学习
</div>
</li>
<li>
<img src="imge/课程.png" alt="">
<h4>Android Hybrid APP开发实战 H5+原生!</h4>
<div class="title">
<span>高级</span> • 1125人在学习
</div>
</li>
<li>
<img src="imge/课程.png" alt="">
<h4>Android Hybrid APP开发实战 H5+原生!</h4>
<div class="title">
<span>高级</span> • 1125人在学习
</div>
</li>
<li>
<img src="imge/课程.png" alt="">
<h4>Android Hybrid APP开发实战 H5+原生!</h4>
<div class="title">
<span>高级</span> • 1125人在学习
</div>
</li>
</ul>
</div>
</div>
</div>
</div>
<!-- 底部 -->
<div class="footer clearfix">
<div class="w">
<div class="copyright">
<img src="imge/logo.png" alt="">
<p>学成在线致力于普及中国最好的教育它与中国一流大学和机构合作提供在线课程。 © 2017年XTCG Inc.保留所有权利。-沪I</p>
<a href="#">下载APP</a>
</div>
<div class="links">
<dl>
<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>
<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>
<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>
</div>
</div>
</div>
</body>
</html>
css代码
*{
margin: 0;
padding: 0;
}
body{
background-color: #f3f3f3;
}
/* 核心区域 */
.w{
width: 1200px;
margin: auto;
}
li{
list-style: none;
}
a{
text-decoration: none;
}
/* 清楚浮动 */
.clearfix:after{
content: "";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
.clearfix{
*zoom: 1;
}
.header{
height: 42px;
/* background-color: pink; */
/* 会叠加w里面的 */
margin: 30px auto;
}
.logo{
float: left;
width: 198px;
height: 42px;
/* background-color: purple; */
}
.nav{
float: left;
margin-left: 60px;
}
.nav ul li{
float: left;
margin: 0 15px;
}
.nav ul li a{
display: block;
height: 42px;
padding: 0 10px;
line-height: 42px;
font-size: 18px;
color: #050505;
}
.nav ul li a:hover{
border-bottom: 2px solid #00a4ff;
color: #00a4ff;
}
/* 搜索 */
.search{
float: left;
width: 412px;
height: 42px;
/* background-color: skyblue; */
margin-left: 70px;
}
.search input{
float: left;
width: 345px;
height: 40px;
border: 1px solid #00a4ff;
border-right: 0;
color: #bfbfbf;
font-size: 14px;
padding-left: 15px;
}
.search button{
width: 50px;
height: 42px;
background:url(imge/btn.png);
/* 按钮有默认边框 行内块有缝隙加浮动解决 */
border: 0;
float: left;
}
.user{
float: right;
line-height: 42px;
margin-right: 30px;
font-size: 14px;
color: #666;
}
.banner{
height: 420px;
background-color: #1c036c;
}
.center{
/* float: left; */
width: 1202px;
height: 420px;
margin: 0 auto;
background-color:pink;
background: url(imge/banner2_20190819_210028.png) no-repeat top center;
}
/* 侧导航栏 */
.center .subnav{
float: left;
width: 180px;
height: 420px;
padding: 0 20px;
background-color: rgb(0,0,0,0.5);
font-size: 14px;
}
.center .subnav ul a{
display: inline-block;
height: 45px;
line-height: 45px;
color: #fff;
width: 100%;
}
.center .subnav ul li span{
float: right;
/* color: #fff; */
}
.center .subnav ul li a:hover{
color: #00a4ff;
}
/* 课程表 */
.center .course{
float:right;
width: 235px;
height: 300px;
/* 浮动盒子不会出现外边距合并问题 */
margin-top: 50px;
background-color: #fff;
}
.center .course h2{
background-color: #9bceea;
height: 48px;
text-align: center;
font-size: 18px;
color: #fff;
line-height: 48px;
}
.center .course .study{
height: 252px;
background-color: #fff;
padding: 0 18px;
}
.study ul li{
padding: 15px 0;
border-bottom: 1px solid #ccc;
}
.study ul li h4{
font-size:16px ;
color: #4e4e4e;
}
.study ul li p{
font-size: 12px;
color: #a5a5a5;
}
.study .more{
display: block;
height: 38px;
border: 1px solid #00a4ff;
margin-top: 5px;
text-align: center;
line-height: 38px;
color: #00a4ff;
font-size: 16px;
font-weight: 700;
}
.goods{
width: 1200px;
height: 58px;
margin-top: 10px;
background-color: #fff;
box-shadow: 0 4px 3px 3px rgba(0,0,0,0.1);
}
.goods h4{
float: left;
width: 124px;
height: 58px;
line-height: 58px;
text-align: center;
color: #00a4ff;
}
.goods ul li{
float: left;
display: block;
width: 124px;
height: 58px;
text-align: center;
}
.goods ul li a{
color: #050505;
font-size: 14px;
line-height: 58px;
}
.goods ul li span{
float: left;
line-height: 58px;
color: #ccc;
}
.goods>a{
float: right;
color: #00a4ff;
font-size: 14px;
line-height: 58px;
margin-right: 26px;
}
.box{
width: 1200px;
margin-top: 35px;
}
.box .box-hd{
height: 25px;
}
.box-hd h4{
float: left;
color: #494949;
font-weight: 400;
}
.box-hd a{
float: right;
color: #a5a5a5;
font-size: 12px;
line-height: 25px;
}
.box-bd{
margin-top: 4px;
/* 两个li掉下去,让父盒子宽度增大 */
width: 1225px;
}
.box-bd ul li{
display: block;
float: left;
height: 270px;
width: 230px;
margin-top: 14px;
margin-right: 13px;
background-color: #fff;
}
.box-bd ul li img{
width: 100%;
}
.box-bd h4{
margin: 20px 20px 20px 25px;
font-weight: 400;
font-size: 14px;
color: #050505;
}
.box-bd .title{
margin: 20px 20px 20px 25px;
font-weight: 400;
font-size: 14px;
color: #999;
}
.box-bd .title span{
color: #ff7c2d;
}
.code{
margin-top: 37px;
width: 1202px;
/* background-color: #fff; */
/* height: 433px; */
}
.code .code-hd{
height: 22px;
/* background-color: pink; */
}
.code-hd h4{
float: left;
font-weight: 400;
color: #494949;
font-size: 16px;
}
.code-hd-center{
margin-left: 355px;
}
.code-hd ul li a{
display: block;
float: left;
padding-right: 70px;
line-height: 24px;
color: #b2b2b3;
font-size: 14px;
}
.code-hd a{
float: right;
margin-right: 34px;
color: #b2b2b3;
font-size: 12px;
}
.code-bd{
margin-top: 23px;
height: 394px;
}
.code-bd .bd-left{
float: left;
width: 230px;
height: 394px;
background-color: #fff;
}
.code-bd .bd-right{
float: left;
margin-left: 14px;
height: 394px;
}
.bd-right .bd-hd img{
height: 100px;
width: 955px;
}
.bd-right li{
float: left;
width: 226px;
margin-right: 13px;
margin-top: 20px;
background-color: #fff;
}
.bd-right li img{
width: 100%;
}
.bd-right h4{
margin: 20px 20px 20px 25px;
font-weight: 400;
font-size: 14px;
color: #050505;
}
.bd-right .title{
margin: 20px 20px 20px 25px;
font-weight: 400;
font-size: 14px;
color: #999;
}
.bd-right .title span{
color: #ff7c2d;
}
.footer{
margin-top: 30px;
height: 418px;
background-color: #fff;
}
.footer .copyright{
float: left;
height: 190px;
width: 437px;
margin: 30px 18px;
}
.copyright p{
/* height: 70px; */
margin: 20px 0 15px 0;
font-size: 12px;
color: #666;
}
.copyright a{
display: block;
height: 35px;
width: 120px;
border: 1px solid #00a4ff;
color: #00a4ff;
font-size: 16px;
line-height: 35px;
text-align: center;
}
.footer .links{
float: right;
}
.links dl{
float: left;
margin-left: 100px;
margin-top: 30px;
}
.links dl dt{
font-size: 16px;
color: #333;
margin-bottom: 5px;
}
.links dd a{
font-size: 12px;
color: #333;
}