以前学习或者练习的案例代码都没有做整理,所以这段时间在回顾一下过去写的案例巩固下基础知识点
项目代码:github。
效果
静态效果
动图效果
代码结构
代码
html
<!DOCTYPE html>
<html>
<head>
<title>css网页页面</title>
<meta charset="utf-8"/>
<link rel="stylesheet" href="css/main.css"/>
</head>
<body>
<!--头部-->
<div class="header">
<div class="logo">
<img src="image/logo.png" />
</div>
<div class="menu">
<ul>
<li>手记</li>
<li>视频</li>
<li>图片</li>
<li>首页</li>
</ul>
</div>
</div>
<!--主体-->
<div class="main">
<div class="pic">
<img src="image/1.jpeg">
</div>
<!--遮罩层-->
<div class="topLayer">
</div>
<div class="btn">
<p>MY BEAUTIFUL LIFE</p>
<button>LOOK MORE ></button>
</div>
<!-- 内容展示区 -->
<div class="content">
<!-- 上部分 -->
<div class="top">
<div>
<div class="icon weibo">
<img src="image/weibo.png">
<div class="des">MICROBLOG</div>
</div>
<div class="icon weixin">
<img src="image/weixin.png" alt="">
<div class="des">WECHAT</div>
</div>
<div class="icon qq">
<img src="image/qq.png" alt="">
<div class="des">QQ</div>
</div>
</div>
<div class="recept">
"I want to give good things to record down,<br>
after the recall will be very beautiful."
</div>
<!-- 中间部分 -->
<div class="picAndDes">
<div class="icon2 ">
<img src="image/03-01.jpg" alt="">
<div class="des1">Cool Image</div>
<div Class="des2">Record The Picture</div>
</div>
<div class="icon2">
<img src="image/03-02.jpg" alt="">
<div class="des1">Great Picture</div>
<div class="des2">Record The Picture</div>
</div>
<div class="icon2">
<img src="image/03-03.jpg" alt="">
<div class="des1">Cool Image</div>
<div class="des2">Record The Picture</div>
</div>
</div>
</div>
<div style="clear:both;"></div><!-- 不加这句话的话,下面的背景会上移 -->
<!-- 下部分 -->
<div class="bottom"><!--包裹层 -->
<div class="bottom-content"><!--内容层 -->
<div class="title">FROM THE PHOTO ALBUM</div>
<div class="picContent">
<dl>
<dt><img src="image/04-01.jpg"></dt>
<dd>
Life is like a book, just read more and more refined, more write more carefully. When read, mind open, all things have been indifferent to heart. Life is the precipitation.
</dd>
</dl>
<dl>
<dt><img src="image/04-02.jpg"></dt>
<dd>
Life is like a cup of tea, let people lead a person to endless aftertastes. You again good taste, it will always have a different taste, different people will have different taste more.
</dd>
</dl>
</div>
<div style="clear: both;"></div>
</div>
<div style="clear: both;"></div>
</div>
<!-- 下部分 -->
<div class="">
</div>
</div>
</div>
<!--底部-->
<div class="footer">
© 2016 imooc.com 京ICP备13046642号
</div>
</body>
</html>
css
*{
padding:0;
margin: 0;
}
.header{
width: 100%;
height: 100px;
/*test*/
/*background-color: black;*/
}
.logo img{
width: 300px;
height:85px;
padding-top: 8px;
margin-left: 50px;
float: left;
}
.menu{
/*test*/
/*background-color: green;*/
float: right;
}
.menu ul{
padding-right: 50px;
}
.menu ul li{
list-style: none;
float: right;
height: 100px;
line-height: 100px;
width: 80px;
font-weight: bold;
text-align: center;
font-family: "微软雅黑";
cursor: pointer;
}
.menu ul li:hover{
color:red;
}
.main .pic img{
width: 100%;
height: 600px;
position: relative;
}
.main .topLayer{
width:100%;
height: 600px;
position: absolute;
top:100px;
left: 0;
background-color: #000;
opacity: 0.5;
z-index: 1;
}
.main .btn{
width: 500px;
height: 300px;
/*test*/
/*background-color: blue;*/
position: absolute;
top:400px;
margin-top: -150px;
right: 50%;
margin-right: -250px;
text-align: center;
z-index: 2;
border:0;
}
.main .btn p{
padding-top: 100px;
color:#fff;
font-size: 45px;
font-family: "微软雅黑";
font-weight: bold;
}
.main .btn button{
margin-top: 50px;
width: 200px;
height: 60px;
color:#fff;
font-family: "微软雅黑";
font-size: 14px;
background-color: #F5704F;
border-radius: 8px;
text-align: center;
font-weight: bold;
border:0;
box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2), 0 6px 20px 0 rgba(0,0,0,0.19);
cursor: pointer;
}
.main .btn button:hover{
box-shadow: 0 12px 16px 0 rgba(0,0,0,0.24), 0 17px 50px 0 rgba(0,0,0,0.19);
}
.main .content{
color: #7c7d7f;
font-size: 20px;
font-weight: bold;
}
.main .content .top{
width: 1000px;
padding-top: 50px;
margin:0 auto;
}
.main .content .top .icon{
float: left;
width: 33.3%;
padding-top: 50px;
text-align: center;
}
.main .content .top .icon img{
width: 100px;
height: 100px;
}
.main .content .top .icon .des{
padding-top: 20px;
}
.main .content .top .recept{
padding-top: 50px;
clear: both;
font-size: 22px;
font-weight: bold;
text-align: center;
font-style: italic;
color:#E19796
}
.main .content .top .picAndDes{
padding-top: 50px;
}
.main .content .top .picAndDes .icon2{
float: left;
padding: 10px;
text-align: center;
}
.main .content .top .picAndDes .icon2 img{
width: 310px;
height: 260px;
}
.main .content .top .picAndDes .icon2 .des1{
padding-top: 10px;
font-size: 20px;
font-weight: bold;
color: #7c7d7f;
}
.main .content .top .picAndDes .icon2 .des2{
color: #BDBDBC;
padding-top: 10px;
}
.main .content .bottom{
width: 100%;
padding-top: 30px;
background-color: #F9F9F9;
}
.main .content .bottom .bottom-content{
width: 1000px;
margin: 0 auto;
margin-bottom: 50px;
/**test**/
/** background-color: black;**/
}
.main .content .bottom .bottom-content .title{
text-align: center;
padding-top: 50px;
font-family: "微软雅黑";
padding-bottom: 40px;
font-size: 20px;
}
.main .content .bottom .bottom-content .picContent dl{
width: 470px;
float: left;
margin: 10px 12px;
}
.main .content .bottom .bottom-content .picContent dl dt img{
width:470px;
height:480px;
}
.main .content .bottom .bottom-content .picContent dl dd{
padding-top: 20px;
}
.footer{
width: 100%;
height: 100px;
line-height: 100px;
text-align: center;
background-color: #292C35;
color: #ffffff;
font-family: "微软雅黑";
font-size: 15px;
}