HTML5+CSS (简易nav设计)

HTML部分:

 

<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="utf-8" />
<link rel="stylesheet" href="css/moveCss.css" />
</head>

<body>
<nav id="nav">
<section class="center">
<h1 class="logo">LOGO</h1>
<ul class="link">
<li class="active"><a href="###">首页</a></li>
<li><a href="###">资讯</li>
<li><a href="###">视频</a></li>
<li><a href="###">聊天</a></li>
<li><a href="###">联系我们</a></li>
</ul>
</section>
</nav>
<header></header>
<section></section>
<footer></footer>
</body>

</html>

 

 

CSS部分:

 


body,h1,ul{
margin: 0; /*去掉外边距*/
padding: 0; /*去掉内边距*/
}

a{
text-decoration: none; /*所有超链接去掉下划线*/
}

ul{
list-style: outside none none; /*去掉ul样式*/
}

#nav{
width: 100%;
height: 70px;
background-color: #CCCCCC;
}

.center{
width: 1280px;
height: 70px;
margin: 0 auto; /*水平居中*/
}
.logo{
width: 50px;
height: 70px;
float: left;
line-height: 70px;
}
.link{
width: 650px;
height: 70px;
line-height: 70px; /*行间居中*/
float: right;
}
.link li{
width: 100px;
float: left;
text-align: center; /*文字居中*/
}
.link a{
display: block; /*块极化元素*/
}
.link a:hover,
.active{
background-color: #C0C0C0; /*鼠标移入链接时,li的背景色变化*/
}

posted @ 2017-05-19 15:59  梁大爷  阅读(2558)  评论(0编辑  收藏  举报