我想知道你是否可以帮助我。我正在尝试仅使用 HTML 和 CSS 创建一个下拉菜单。但是,我的悬停功能不像以前那样在 IE10 中工作。它适用于其他浏览器,如 firefox 和 chrome,但不适用于 IE10。
我的 HTML 代码
<html>
<head>
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="style.css" />
<![endif]-->
<link rel = "stylesheet" type = "text/css" href = "style.css" />
</head>
<body>
<div class = "centeredmenu">
<ul>
<li><a href = "#">Home</a></li>
<li><a href = "#">Client</a>
<ul>
<li><a href = "#">Create Client</a></li>
<li><a href = "#">View Clients</a></li>
</ul>
</li>
<li><a href = "#">Invoices</a>
<ul>
<li><a href = "#">Search</a></li>
<li><a href = "#">View All</a></li>
</ul>
</li>
<li><a href = "#">Suppliers</a>
<ul>
<li><a href = "#">Add Supplier</a></li>
<li><a href = "#">View All</a></li>
</ul>
</li>
</ul>
</div>
</body>
</html>
我的 CSS 代码
.centeredmenu ul li ul { display:none; }
.centeredmenu ul li:hover > ul { display:block; }
.centeredmenu ul li ul li ul { display:none; }
.centeredmenu ul li ul li:hover > ul { display:block; }
.centeredmenu ul {
background:#9bbe3c;
width:99.8%;
margin-top:0.5%;
z-index:1;
list-style:none;
position:relative;
display:inline-table;
font-family:'Calibri' !important;
font-size:1em;
border:1px solid #596f1b;
}
.centeredmenu ul:after { content: ""; clear:both; display:block; }
.centeredmenu ul li { float:left; }
.centeredmenu ul li a {
display:block;
color:#fff;
text-decoration:none;
padding:14px 22px 14px 23px !important;
}
.centeredmenu ul li a:hover{ background:#586f1b; }
.centeredmenu ul li ul { background:#9bbe3c; position:absolute; top:94.5%; width:200px; }
.centeredmenu ul li ul li { float:none; position:relative; }
.centeredmenu ul li ul li ul { background:#9bbe3c; position:absolute; left:101%; top:-1%; }