【发布时间】:2014-06-30 05:10:42
【问题描述】:
我要做的是创建一个下拉菜单以在移动网站上使用。由于您无法将鼠标悬停在菜单项上以查看子菜单,因此我需要解决该问题。我对此进行了研究并试图解决这个问题。很多网站推荐使用带有 onclick 功能的 JS。我无法掌握它。谢谢。
这是 HTML。
<html>
<head>
<link rel="stylesheet" href="phone.css">
</head>
<body>
<div class="smenu_div">
<ul>
<li><a href="#">Menu</a>
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="#">Illustrator</a></li>
<li><a href="#">Web Design</a></li>
</li>
</ul>
</ul>
</div>
</body></html>
这里是 CSS。
/*Small Menu*/
.smenu_div ul
{
padding:0px;
margin-top:35px;
margin-right:40px;
font-family:georgia;
font-size:60px;
color:#ffffff;
list-style:none;
text-indent:15px;
text-align:center;
width:35%;
float:right;
overflow:hidden;
}
.smenu_div ul li
{
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
background:#000000;
line-height:justified;
border-bottom:1px solid #333;
margin-top: 10px;
}
.smenu_div li ul:active{ display: block; }
.smenu_div ul li a
{
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
text-decoration:none;
color:#ffffff;
display:block;
}
.smenu_div ul li a:hover
{
color:#000000;
background:#fdff30;
}
.smenu_div ul li#active
{
color:#000000;
background:#fdff30;
}
【问题讨论】:
-
我注意到它似乎最后一个在错误的地方,在 html 中。
标签: javascript android html css drop-down-menu