我正在尝试为“我们的收藏”创建一个下拉菜单栏,但我的尝试不起作用。任何人都可以借我一把。下面是我的html和它的CSS。我已删除了我的随机试错吧,并保持。菜单UL UL {显示:无} 如何添加一个下拉菜单到我的菜单栏
* html .clearfix {
height: 1%;
overflow: visible;
}
* + html .clearfix {
min-height: 1%;
}
.clearfix:after {
clear: both;
content: ".";
display: block;
height: 0;
visibility: hidden;
font-size: 0;
}
body {
margin: 0;
padding: 0;
}
.menu {
text-align: center;
background-color: #222;
}
.menu ul {
list-style: none;
height: auto;
padding: 40px;
width: 500px;
float: right;
}
.menu ul li {
float: left;
padding: 0 20px;
font-size: 20px;
font-family: Impact;
}
.menu ul ul {
display: none;
}
.menu ul li a {
color: white;
text-decoration: none;
transition: 350ms;
}
.menu ul li a:hover {
color: #ed702b
}
.title {
float: left;
font-size: 40px;
margin-left: -173px;
margin-top: 37px;
}
.title a {
text-decoration: none;
color: white;
}
.center {
width: 980px;
margin: 0 auto;
}
<!DOCTYPE html>
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<link rel="stylesheet" type="text/css" href="includes/site.css">
<title>Home</title>
</head>
<body>
<div class="menu">
<div class="center clearfix" style="height: 124px">
<h1 class="title"><a href="#">My first web</a></h1>
<ul class="clearfix">
<li><a href="#">Home</a>
</li>
<li><a href="#">Our Collections</a>
</li>
<ul>
<li><a href="#">First Collection</a>
</li>
<li><a href="#">Second Collection</a>
</li>
</ul>
<li><a href="#">About Us</a>
</li>
<li><a href="#">Contact Us</a>
</li>
</ul>
</div>
</div>
</body>
</html>
可能重复【如何做一个纯粹的基于CSS的下拉菜单菜单?(http://stackoverflow.com/questions/9953482/how-to-make-a-pure-css-based-dropdown-menu) – xDaevax 2014-09-24 14:40:26