<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>导航条</title>
<style type="text/css">
*{
padding: 0;
margin: 0;
}
.nav{
list-style: none;
background-color: white;
width: 1000px;
margin: 50px auto;
overflow: hidden;
}
.nav li{
float: left;
width: 25%;
}
.nav a{
display: block;
width: 100%;
text-align: center;
padding: 5px 0;
text-decoration: none;
color: red;
font-weight: bold;
}
.nav a:hover{
background-color: #c00;
}
.clearfix:after{
content: "";
display: block;
clear: both;
}
.clearfix{
zoom:1;
}
</style>
</head>
<body>
<ul class="nav clearfix:">
<li><a href="#">首页</a></li>
<li><a href="#">新闻</a></li>
<li><a href="#">联系</a></li>
<li><a href="#">关于</a></li>
</ul>
</body>
</html>
导航条 代码效果
图片.png
作业2代码效果 图片.png
网友评论