我在下拉菜单中获取一些文本时遇到问题。知道怎么解决吗?
这是HTML和C#
<ul class="dropdown">
<li>
<p class="MenuOverskrift">
<a href="#">Produkter</a>
</p>
<ul>
<asp:Label ID="lbl_Standard_Panel" runat="server" Text="" />
</ul>
</li>
</ul>
string standard_Menu = "";
foreach (Products group in Products.GetEvereGroup(connection))
{
standard_Menu += "<li>" +
"<p>" +
group.GroupName +
"</p>" +
"<ul>";
foreach (Products product in Products.GetProductsByGroup(group.GroupID, connection))
{
standard_Menu += "<li>" +
"<p>" +
"<a href=\"_" + product.Link + "\">" + product.ProductName + "</a>" +
"</p>" +
"</li>";
}
standard_Menu += "</ul>" +
"</li>";
lbl_Standard_Panel.Text = standard_Menu;
}
这是CSS
#Menu_Standard
{
position: relative;
left: 550px;
width: 100px;
}
#Menu_Standard ul li ul li p
{
color: #9c8b5c;
}
#Menu_Standard ul ul ul
{
right: 100px;
}
#Menu_Standard ul li ul li a
{
color: #9c8b5c;
text-decoration: none;
font-size: medium;
}
#Menu_Standard a
{
color: #9c8b5c;
text-decoration: none;
font-size: x-large;
}
ul.dropdown ul
{
visibility: hidden;
position:relative;
z-index:1;
width: auto;
}
ul.dropdown li:hover > ul
{
visibility: visible;
background-color: #373741;
filter:alpha(opacity=60);
border-radius: 15px;
padding: 5px;
}
这是问题的图片
任何帮助将不胜感激
通过改变visibilty修复了一些问题:隐藏; to diplay:none;
但是在悬停时问题仍然存在
答案 0 :(得分:2)
当元素设置为visibility: hidden
属性且元素的不透明度为0时,请改用display: none
。