利用刚学习的html,css知识防网页头部。
下边是html代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>php中文网</title>
<link rel="stylesheet" href="./static/font/iconfont.css">
<link rel="stylesheet" href="./static/css/index.css">
</head>
<body>
<header id="header">
<div class="logo">
<img src="./static/images/logo.png" alt="">
</div>
<div class="header-right">
<div class="searcher">
<input type="text" id="searcher">
<span class="icon iconfont icon-sousuo2"></span>
</div>
<div class="list">
<span class="icon iconfont icon-huiyuan1"></span>
<span class="icon iconfont icon-danmu1"></span>
<span class="icon iconfont icon-fabu"></span>
<span class="icon iconfont icon-fangda"></span>
<span class="icon iconfont icon-huiyuan2"></span>
<span class="icon iconfont icon-dianzan"></span>
</div>
</div>
</header>
<nav id="nav">
<div class="nav-item">
<div class="nav-ico">
<span class="icon iconfont icon-gongdan"></span>
<p nav-title>资讯<br>学习</p>
</div>
<div class="nav-list">
<ul>
<li><a href="#">器材</a></li>
<li><a href="#">器材</a></li>
<li><a href="#">器材</a></li>
<li><a href="#">器材</a></li>
<li><a href="#">器材</a></li>
<li><a href="#">器材</a></li>
<li><a href="#">器材</a></li>
<li><a href="#">器材</a></li>
</ul>
</div>
</div>
<div class="nav-item">
<div class="nav-ico">
<span class="icon iconfont icon-gongdan"></span>
<p nav-title>资讯<br>学习</p>
</div>
<div class="nav-list">
<ul>
<li><a href="#">器材</a></li>
<li><a href="#">器材</a></li>
<li><a href="#">器材</a></li>
<li><a href="#">器材</a></li>
<li><a href="#">器材</a></li>
<li><a href="#">器材</a></li>
<li><a href="#">器材</a></li>
<li><a href="#">器材</a></li>
</ul>
</div>
</div>
<div class="nav-item">
<div class="nav-ico">
<span class="icon iconfont icon-gongdan"></span>
<p nav-title>资讯<br>学习</p>
</div>
<div class="nav-list">
<ul>
<li><a href="#">器材</a></li>
<li><a href="#">器材</a></li>
<li><a href="#">器材</a></li>
<li><a href="#">器材</a></li>
<li><a href="#">器材</a></li>
<li><a href="#">器材</a></li>
<li><a href="#">器材</a></li>
<li><a href="#">器材</a></li>
</ul>
</div>
</div>
<div class="nav-item">
<div class="nav-ico">
<span class="icon iconfont icon-gongdan"></span>
<p nav-title>资讯<br>学习</p>
</div>
<div class="nav-list">
<ul>
<li><a href="#">器材</a></li>
<li><a href="#">器材</a></li>
<li><a href="#">器材</a></li>
<li><a href="#">器材</a></li>
<li><a href="#">器材</a></li>
<li><a href="#">器材</a></li>
<li><a href="#">器材</a></li>
<li><a href="#">器材</a></li>
</ul>
</div>
</div>
</nav>
<div id="banner">
<img src="./static/images/2.jpg" alt="" width="1200px" height="430">
<img src="./static/images/banner-right.jpg" alt="" width="390" height="430">
</div>
</body>
</html>
下边是css代码:
*{
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: "Microsoft YaHei UI";
}
#header{
width: 1600px;
margin: 0 auto;
height: 160px;
}
#header .logo{
height:160px;
float: left;
}
#header .logo img{
height: 70px;
width: 200px;
margin-top: 40px;
}
#header .header-right{
width:850px;
height:160px;
line-height: 160px;
float:right;
}
#header .header-right .searcher{
float:left;
position: relative;
}
#header .header-right span{
width: 30px;
}
#header .header-right #searcher{
width: 440px;
height:50px;
border-radius: 10px;
box-shadow: none;
border: 1px solid #ccc;
}
#header .header-right .searcher .iconfont{
font-size: 35px;
position: absolute;
left: 390px;
color: #ccc;
}
#header .header-right .list{
float:right;
}
#header .list .iconfont{
font-size:40px;
margin-left: 15px;
}
/*导航开始*/
#nav{
width: 1600px;
height: 100px;
margin: 0 auto;
color: #333;
font-size: 16px;
font-weight: bold;
}
#nav .nav-ico{
width: 120px;
border-right: 1px solid #ccc;
float: left;
}
#nav .nav-ico .iconfont{
font-size: 50px;
color: red;
display: inline-block;
float: left;
margin-right: 10px;
}
#nav .nav-ico p{
line-height: 30px;
margin-left: 15px;
}
#nav .nav-list{
width: 220px;
float: left;
margin-right: 40px;
}
#nav ul li{
list-style: none;
display: block;
float: left;
margin: 5px 10px;
white-space: nowrap;
}
#nav ul li a{
color: #555;
text-decoration: none;
}
/*banner开始*/
#banner{
width: 1600px;
margin: 0 auto;
}
效果图