PSD源文件
PS(切片)+sublime(代码)+chrome(测试)
知晓版心:一定要量好长宽
分析页面中的行模块,以及每个行模块中的列模块。
制作HTML结构。
通过CSS+DIV布局
1) 头部制作
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Documenttitle>
<link rel="stylesheet" href="style.css">
head>
<body>
<div class="header w">
<div class="logo">
<img src="images/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="images/user.png" alt="">
HuaLi
div>
div>
body>
html>
/*清除元素默认边距*/
*{
margin: 0;
padding: 0;
}
li{
list-style: none;
}
button{
border: none;
}
body{
background-color: #f3f5f7;
}
.w{
width: 1200px;
margin: auto;
}
.header{
height: 42px;
/*background-color: pink;*/
margin: 30px auto;
}
.logo
{
float: left;
margin-right: 60px;
}
.logo img{
height: 42px;
}
.nav {
float: left;
}
.nav ul li{
float: left;
}
.nav ul li a{
display: block;
height: 40px;
padding: 0 10px;
margin-right: 20px;
line-height: 40px;
font-style: 18px;
color: #505050;
text-decoration: none;
}
/*鼠标经过出现下边框*/
.nav ul li a:hover{
border-bottom: 2px solid #00a4ff;
}
.search{
float: left;
margin-left: 70px;
}
.search input{
height: 40px;
width: 340px;
border: 1px solid #00a4ff;
border-right: 0;
padding-left: 20px;
color: #ccc;
float: left;
}
.search button{
width: 50px;
height: 42px;
background: url(images/btn.jpg);
float: left;
}
.user{
float: left;
height: 42px;
line-height: 42px;
margin-left: 30px;
font-size: 14px;
color: #666;
}
2)banner部分
<div class="banner">
<div class="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="#">UI设计<span>>span>a>li>
<li><a href="#">产品<span>>span>a>li>
ul>
div>
<div class="course">
<div class="course-hd">我的课程表div>
<div class="course-bd">
<ul>
<li>
<h4>继续学习 程序语言设计h4>
<p>正在学习-使用对象p>
li>
<li>
<h4>继续学习 程序语言设计h4>
<p>正在学习-使用对象p>
li>
<li>
<h4>继续学习 程序语言设计h4>
<p>正在学习-使用对象p>
li>
ul>
<a href="#" class="all">全部课程a>
div>
div>
div>
div>
.banner{
height: 420px;
background: #1c036c url(images/ban.png) no-repeat top center;
background-color: #1c036c;
}
.subnav{
width: 150px;
height: 420px;
padding: 0 20px;
/*黑色半透明*/
background: rgba(0, 0, 0, .3);
float: left;
}
.subnav ul li{
height: 45px;
line-height: 45px;
}
.subnav li a{
color: #fff;
font-size: 14px;
text-decoration: none;
}
.subnav li a:hover {
color: #00b4ff;
}
.subnav ul li a span {
float: right;
}
.course {
float: right;
width: 228px;
height: 300px;
background-color: #fff;
margin-top: 50px;
}
.course-hd{
height: 48px;
background-color: #9bceea;
font-size: 18px;
text-align: center;
line-height: 48px;
color: #fff;
font-weight: bold;
}
.course-bd
{
/*没有宽度的盒子,padding不会撑开*/
padding: 0 15px;
}
.course-bd ul{
padding-top: 10px;
}
.course-bd ul li {
/*行高等于高度,只能用于单行文本*/
height: 50px;
border-bottom: 1px solid #ccc;
margin-top: 10px;
}
.course-bd li h4{
font-style: 14px;
color: #4e4e4e;
}
.course-bd li p{
font-style: 12px;
color: #a5a5a5;
}
.all{
display: block;
height: 38px;
border: 1px solid #00a4ff;
margin-top: 10px;
font-style: 16px;
color: #00a4ff;
text-align: center;
line-height: 38px;
}
.all:hover{
background-color: #00a4ff;
color: #fff;
}
3)精品推荐模块
<div class="goods w">
<h3>精品推荐h3>
<div class="goods-item">
| <a href="#">jQuerya>
| <a href="#">Sparka>
| <a href="#">MySQLa>
| <a href="#">JavaWeba>
| <a href="#">MySQLa>
| <a href="#">JavaWeba>
div>
<div class="mod">修改兴趣div>
div>
<div class="box w">
<div class="box-hd">
<h3>精品推荐h3>
<a href="#">查看全部a>
div>
<div class="box-bd clearfix">
<ul>
<li>
<img src="images/pic1.png" alt="">
<h4>Think PHP 高级博客实战h4>
<p><span>高级span>-1125人在学习p>
li>
<li>
<img src="images/pic1.png" alt="">
<h4>Think PHP 高级博客实战h4>
<p><span>高级span>-1125人在学习p>
li>
<li>
<img src="images/pic1.png" alt="">
<h4>Think PHP 高级博客实战h4>
<p><span>高级span>-1125人在学习p>
li>
<li>
<img src="images/pic1.png" alt="">
<h4>Think PHP 高级博客实战h4>
<p><span>高级span>-1125人在学习p>
li>
<li>
<img src="images/pic1.png" alt="">
<h4>Think PHP 高级博客实战h4>
<p><span>高级span>-1125人在学习p>
li>
<li>
<img src="images/pic1.png" alt="">
<h4>Think PHP 高级博客实战h4>
<p><span>高级span>-1125人在学习p>
li>
<li>
<img src="images/pic1.png" alt="">
<h4>Think PHP 高级博客实战h4>
<p><span>高级span>-1125人在学习p>
li>
<li>
<img src="images/pic1.png" alt="">
<h4>Think PHP 高级博客实战h4>
<p><span>高级span>-1125人在学习p>
li>
<li>
<img src="images/pic1.png" alt="">
<h4>Think PHP 高级博客实战h4>
<p><span>高级span>-1125人在学习p>
li>
<li>
<img src="images/pic1.png" alt="">
<h4>Think PHP 高级博客实战h4>
<p><span>高级span>-1125人在学习p>
li>
ul>
div>
div>
/*goods开始*/
.goods{
height: 60px;
background-color: #fff;
margin-top: 10px;
line-height: 60px;
box-shadow: 2px 2px 2px rgba(0,0,0,.2);
}
.goods h3{
float: left;
margin: 0 30px;
font-style: 16px;
color: #00a4ff;
}
.goods-item{
float: left;
color: #bfbfbf;
}
.goods-item a{
font-style: 16px;
color: #505050;
margin: 0 30px ;
}
.goods-item a:hover{
color: #00b4ff;
}
.mod{
float: right;
margin-right: 30px;
font-size: 14px;
color: #00a4ff;
}
/*box*/
.box{
margin-top: 15px;
}
.box-hd{
height: 60px;
line-height: 60px;
}
.box-hd h3{
float: left;
font-size: 20px;
color: #494949;
font-weight: 400;
}
.box-hd a{
float: right;
font-style: 12px;
color: #a5a5a5;
margin-right: 30px;
}
.box-bd{
/*不要给高度,行数不确定*/
/*box-bd宽度超过版心是可以的*/
width: 1215px;
}
.box-bd li{
float: left;
width: 228px;
height: 270px;
margin-right: 15px;
margin-bottom: 15px;
background-color: #fff;
box-shadow: 2px 2px 2px rgba(0,0,0,.3)
}
.box-bd li img{
width: 100%;
}
.box-bd li h4{
margin: 20px;
font-size: 14px;
color: #505050;
font-weight: 400;
}
.box-bd li p{
margin: 0 20px;
font-size: 14px;
color: #999;
}
.box-bd p span{
color: orange;
}
<div class="footer">
<div class="w">
<div class="copyright">
<img src="images/logo.png" alt="">
<p>学成在线,加油加油加油加油加油加油p>
<a href="#" class="app">下载 appa>
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>
dl>
div>
div>
div>
```css
/*footer*/
.footer{
height: 385px;
background-color: #fff;
padding: 30px;
}
.copyright{
float: left;
}
.copyright p{
font-size: 12px;
color: #666;
margin: 20px 0 15px 0;
}
.app{
display: block;
width: 118px;
height: 34px;
border: 1px solid #009bff;
text-align: center;
line-height: 34px;
font-size: 16px;
}
.app:hover{
color: #00a4ff;
}
.links{
float: right;
}
.links dl{
float: left;
margin-left: 100px;
}
.links dt{
height: 35px;
font-size: 16px;
color: #333;
}
.links dd a{
font-size: 12px;
color: #333;
}
.links dd a:hover{
color: #00a4ff;
}