htm文件
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="css/index_styles.css">
<link rel="stylesheet" type="text/css" href="css/reset.css">//这里的reset.css是一个单独文件
</head>
<body>
<nav>
<ul>
<li><a href="">首页</a></li>
<html>
<head>
<title></title>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="css/index_styles.css">
<link rel="stylesheet" type="text/css" href="css/reset.css">//这里的reset.css是一个单独文件
</head>
<body>
<nav>
<ul>
<li><a href="">首页</a></li>
<li><a href="">菜单1</a>
<ul>
<li>菜单11</li>
<li>菜单12</li>
</ul>
</li>
<ul>
<li>菜单11</li>
<li>菜单12</li>
</ul>
</li>
<li><a href="">菜单2</a>
<ul>
<li>菜单21</li>
<li>菜单22</li>
</ul>
</li>
</ul>
</nav>
</body>
</html>
<ul>
<li>菜单21</li>
<li>菜单22</li>
</ul>
</li>
</ul>
</nav>
</body>
</html>
css文件
nav li{width: 100px; float: left;list-style: none;}
nav li ul{display: none;}
nav>ul>li:hover ul{display: block;}
nav li ul{display: none;}
nav>ul>li:hover ul{display: block;}