小试牛刀
到现在为止,我们已经将css要学习的初级中级高级知识都已经学完了,接下来我们就应该对自己做一个小测验了,以下就是我的小测验,模拟qq会员官网的头部栏!
素材
bg.png背景图
logo.png 企鹅logo图
qqvip官网头部栏示例
代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>qq会员官网头部栏</title>
<style>
body,a,div{
margin: 0;
padding: 0;
text-decoration: none;
}
body{
background-image: url("images/bg.png");
background-repeat: no-repeat;
}
ul{
margin: 0;
padding: 0;
list-style: none;
}
#app{
position: relative;
width: 100%;
height: 150px;
background: #282424;
overflow: hidden;
}
#logo{
position: fixed;
display: inline-block;
float: left;
}
#login{
position: relative;
display: inline-block;
right: -400px;
top: 60px;
border: 2px yellow solid;
border-radius: 45px;
}
#login a{
text-align: center;
font: 20px bold;
line-height: 40px;
display: inline-block;
width: 80px;
height: 40px;
color: yellow;
}
#login:hover{
background: #939331;
}
#register{
position: relative;
display: inline-block;
border: 2px yellow solid;
border-radius: 45px;
right: -450px;
top: 60px;
background: #939331;
}
#register a{
text-align: center;
font: 20px bold;
line-height: 40px;
display: inline-block;
width: 200px;
height: 40px;
color: yellow;
}
#list{
position: relative;
display: inline-block;
width: 600px;
height: 50px;
left: 400px;
top: 60px;
}
#list a{
text-align: center;
font: 14px bold;
line-height: 50px;
display: inline-block;
width: 90px;
height: 50px;
color: white;
}
#list a:hover{
color: red;
}
</style>
</head>
<body>
<div id="app">
<div id="logo">
<img src="images/qqviplogo.png" alt="vip">
</div>
<div id="list">
<a href="">靓号站 </a>
<a href="">功能特权 </a>
<a href="">游戏特权 </a>
<a href="">成长体系 </a>
<a href="">年费专区 </a>
<a href="">免流量特权 </a>
</div>
<div id="login">
<a href="#">登录</a>
</div>
<div id="register">
<a href="">开通超级会员</a>
</div>
</div>
</body>
</html>
效果