<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
* {
margin: 0;
padding: 0;
text-decoration: none;
list-style: none;
}
//导航条设计
.nav {
width: 1500px;
height: 50px;
background-color: rgb(39, 203, 191);
border-radius: 10px;
border: 3px solid rgb(255, 254, 255);
box-shadow: 0 0 5px rgba(255, 0, 0, 0.5);
margin: 50px auto;
}
.navlist {
width: 1000px;
height: 50px;
display: block;
/* background-color: pink; */
margin-left: 50px;
}
.navitem {
float: left;
width: auto;
display: block;
}
.navitem a {
color: white;
height: 50px;
width: 70px;
display: block;
text-align: center;
line-height: 50px;
}
.navitem:hover {
background-color: rgb(0, 188, 211);
}
.navitem:first-of-type {
background-color: rgb(0, 188, 211);
}
//下拉框设计
.droplist {
background-color: #fff;
/* box-shadow: #eee; */
border: 1px solid aquamarine;
/* clear: both; */
display: block;
position: absolute;
display: none;//隐藏下拉框
}
.dropitem:hover {
background-color: gray;
color: white;
}
.navitem:hover .droplist{
display: block;//点击显示下拉框
}
</style>
</head>
<body>
<div class="nav">
<ul class="navlist">
<li class="navitem">
<a href="#">首页</a>
</li>
<li class="navitem">
<a href="#">机票</a>
<ul class="droplist">
<li class="dropitem">楚一皇</li>
<li class="dropitem">楚一皇</li>
<li class="dropitem">楚一皇</li>
<li class="dropitem">楚一皇</li>
</ul>
</li>
<li class="navitem">
<a href="#">酒店</a>
<ul class="droplist">
<li class="dropitem">楚一皇</li>
<li class="dropitem">楚一皇</li>
<li class="dropitem">楚一皇</li>
<li class="dropitem">得无报搏。jjvjahcdksdhkv</li>
</ul>
</li>
<li class="navitem">
<a href="#">火车票</a>
<ul class="droplist">
<li class="dropitem">楚一皇</li>
<li class="dropitem">楚一皇</li>
<li class="dropitem">楚一皇</li>
<li class="dropitem">得无报搏。jjvjahcdksdhkv</li>
</ul>
</li>
<li class="navitem">
<a href="#">度假</a>
<ul class="droplist">
<li class="dropitem">楚一皇</li>
<li class="dropitem">楚一皇</li>
<li class="dropitem">楚一皇</li>
<li class="dropitem">得无报搏。jjvjahcdksdhkv</li>
</ul>
</li>
<li class="navitem">
<a href="#">团购</a>
<ul class="droplist">
<li class="dropitem">楚一皇</li>
<li class="dropitem">楚一皇</li>
<li class="dropitem">楚一皇</li>
<li class="dropitem">得无报搏。jjvjahcdksdhkv</li>
</ul>
</li>
<li class="navitem">
<a href="#">门票</a>
<ul class="droplist">
<li class="dropitem">楚一皇</li>
<li class="dropitem">楚一皇</li>
<li class="dropitem">楚一皇</li>
<li class="dropitem">得无报搏。jjvjahcdksdhkv</li>
</ul>
</li>
<li class="navitem">
<a href="#">当地人</a>
<ul class="droplist">
<li class="dropitem">楚一皇</li>
<li class="dropitem">楚一皇</li>
<li class="dropitem">楚一皇</li>
<li class="dropitem">得无报搏。jjvjahcdksdhkv</li>
</ul>
</li>
<li class="navitem">
<a href="#">汽车票</a>
<ul class="droplist">
<li class="dropitem">楚一皇</li>
<li class="dropitem">楚一皇</li>
<li class="dropitem">楚一皇</li>
<li class="dropitem">得无报搏。jjvjahcdksdhkv</li>
</ul>
</li>
<li class="navitem">
<a href="#">行程设计</a>
<ul class="droplist">
<li class="dropitem">楚一皇</li>
<li class="dropitem">楚一皇</li>
<li class="dropitem">楚一皇</li>
<li class="dropitem">得无报搏。jjvjahcdksdhkv</li>
</ul>
</li>
<li class="navitem">
<a href="#">攻略</a>
<ul class="droplist">
<li class="dropitem">楚一皇</li>
<li class="dropitem">楚一皇</li>
<li class="dropitem">楚一皇</li>
<li class="dropitem">得无报搏。jjvjahcdksdhkv</li>
</ul>
</li>
<li class="navitem">
<a href="#">旅游快讯</a>
<ul class="droplist">
<li class="dropitem">楚一皇</li>
<li class="dropitem">楚一皇</li>
<li class="dropitem">楚一皇</li>
<li class="dropitem">得无报搏。jjvjahcdksdhkv</li>
</ul>
</li>
</ul>
</div>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
* {
margin: 0;
padding: 0;
text-decoration: none;
list-style: none;
}
.nav {
width: 1500px;
height: 50px;
background-color: rgb(39, 203, 191);
border-radius: 10px;
border: 3px solid rgb(255, 254, 255);
box-shadow: 0 0 5px rgba(255, 0, 0, 0.5);
margin: 50px auto;
}
.navlist {
width: 1000px;
height: 50px;
display: block;
/* background-color: pink; */
margin-left: 50px;
}
.navitem {
float: left;
width: auto;
display: block;
}
.navitem a {
color: white;
height: 50px;
width: 70px;
display: block;
text-align: center;
line-height: 50px;
}
.navitem:hover {
background-color: rgb(0, 188, 211);
}
.navitem:first-of-type {
background-color: rgb(0, 188, 211);
}
.droplist {
background-color: #fff;
/* box-shadow: #eee; */
border: 1px solid aquamarine;
/* clear: both; */
display: block;
position: absolute;
display: none;
}
.dropitem:hover {
background-color: gray;
color: white;
}
.navitem:hover .droplist{
display: block;
}
</style>
</head>
<body>
<div class="nav">
<ul class="navlist">
<li class="navitem">
<a href="#">首页</a>
</li>
<li class="navitem">
<a href="#">机票</a>
<ul class="droplist">
<li class="dropitem">楚一皇</li>
<li class="dropitem">楚一皇</li>
<li class="dropitem">楚一皇</li>
<li class="dropitem">楚一皇</li>
</ul>
</li>
<li class="navitem">
<a href="#">酒店</a>
<ul class="droplist">
<li class="dropitem">楚一皇</li>
<li class="dropitem">楚一皇</li>
<li class="dropitem">楚一皇</li>
<li class="dropitem">得无报搏。jjvjahcdksdhkv</li>
</ul>
</li>
<li class="navitem">
<a href="#">火车票</a>
<ul class="droplist">
<li class="dropitem">楚一皇</li>
<li class="dropitem">楚一皇</li>
<li class="dropitem">楚一皇</li>
<li class="dropitem">得无报搏。jjvjahcdksdhkv</li>
</ul>
</li>
<li class="navitem">
<a href="#">度假</a>
<ul class="droplist">
<li class="dropitem">楚一皇</li>
<li class="dropitem">楚一皇</li>
<li class="dropitem">楚一皇</li>
<li class="dropitem">得无报搏。jjvjahcdksdhkv</li>
</ul>
</li>
<li class="navitem">
<a href="#">团购</a>
<ul class="droplist">
<li class="dropitem">楚一皇</li>
<li class="dropitem">楚一皇</li>
<li class="dropitem">楚一皇</li>
<li class="dropitem">得无报搏。jjvjahcdksdhkv</li>
</ul>
</li>
<li class="navitem">
<a href="#">门票</a>
<ul class="droplist">
<li class="dropitem">楚一皇</li>
<li class="dropitem">楚一皇</li>
<li class="dropitem">楚一皇</li>
<li class="dropitem">得无报搏。jjvjahcdksdhkv</li>
</ul>
</li>
<li class="navitem">
<a href="#">当地人</a>
<ul class="droplist">
<li class="dropitem">楚一皇</li>
<li class="dropitem">楚一皇</li>
<li class="dropitem">楚一皇</li>
<li class="dropitem">得无报搏。jjvjahcdksdhkv</li>
</ul>
</li>
<li class="navitem">
<a href="#">汽车票</a>
<ul class="droplist">
<li class="dropitem">楚一皇</li>
<li class="dropitem">楚一皇</li>
<li class="dropitem">楚一皇</li>
<li class="dropitem">得无报搏。jjvjahcdksdhkv</li>
</ul>
</li>
<li class="navitem">
<a href="#">行程设计</a>
<ul class="droplist">
<li class="dropitem">楚一皇</li>
<li class="dropitem">楚一皇</li>
<li class="dropitem">楚一皇</li>
<li class="dropitem">得无报搏。jjvjahcdksdhkv</li>
</ul>
</li>
<li class="navitem">
<a href="#">攻略</a>
<ul class="droplist">
<li class="dropitem">楚一皇</li>
<li class="dropitem">楚一皇</li>
<li class="dropitem">楚一皇</li>
<li class="dropitem">得无报搏。jjvjahcdksdhkv</li>
</ul>
</li>
<li class="navitem">
<a href="#">旅游快讯</a>
<ul class="droplist">
<li class="dropitem">楚一皇</li>
<li class="dropitem">楚一皇</li>
<li class="dropitem">楚一皇</li>
<li class="dropitem">得无报搏。jjvjahcdksdhkv</li>
</ul>
</li>
</ul>
</div>
</body>
</html>
实现结果: