<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>定位做导航</title>
<style>
*{
padding: 0px;
}
li{
width: 80px;
list-style: none;
font-size: 13px;
line-height: 30px;
text-align: center;
margin-left: 2px;
}
a{
text-decoration: none;
color: white;
}
nav{
width: 800px;
height: 30px;
margin:auto;
background: red;
}
nav>ul{
width: 800px;
height: 30px;
background: red;
}
li:nth-child(2){
position: relative;
left: 80px;
top: -30px;
}
li:nth-child(3)
{
position: relative;
left: 160px;
top: -60px;
}
li:nth-child(4){
position: relative;
left: 240px;
top: -90px;
}
li:nth-child(5){
position: relative;
left: 320px;
top: -120px;
}
li:nth-child(6){
position: relative;
left: 400px;
top: -150px;
}
li:hover{
background: white;
border-top: 1px solid red;
}
li:hover>a{
color: black;
}
</style>
</head>
<body>
<nav>
<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>
</ul>
</nav>
</body>
</html>
相关推荐
© 2020 asciim码
人生就是一场修行