하위 메뉴 항목을 슬라이딩하여 메뉴 막대를 만들고 싶었습니다. 이를 위해 다음 코드를 작성했지만 전환 (슬라이드 다운) 효과는 호버에서 작동하지 않습니다. 나는 CSS를 사용해서 그것을하고 싶다. 누군가 나를 도와주세요.CSS를 사용하여 마우스 오버시 마우스 오버시 문제가있는 메뉴
<html>
<head>
<style type="text/css">
.menu {
width: 100%;
background-color: rgba(250,250,250,0.9);
box-shadow: 0 2px 2px -2px rgba(0,0,0,0.6);
}
.menu ul{
list-style: none;
color: #31373d;
padding: 0;
margin: 0px 20px;
position: relative;
}
.menu ul li{
height: 35px;
line-height: 35px;
font-weight: 600;
width: 100px;
text-align: center;
.menu > ul {
z-index: 0;
}
.menu > ul > li {
display: inline-block;
padding: 5px 10px;
margin: 0;
margin-right: 5px;
position: relative;
cursor: pointer;
text-shadow: 1px 2px 2px white;
}
.menu ul ul {
display: none;
height: 0px; /* Height initially set to 0 */
overflow: hidden;
background: #f0f0f0;
-moz-transition: height 0.5s linear;
text-shadow: 1px 2px 2px #f0f0f0;
box-shadow: 0 4px 2px -2px rgba(0,0,0,0.1);
z-index: 2;
border: 1px solid #a0a0a0;
-webkit-transition: height 0.3s linear;
-moz-transition: height 0.3s linear;
-o-transition: height 0.3s linear;
-ms-transition: height 0.3s linear;
transition: height 0.3s linear;
left: -23px;
top: 45px;
}
.menu > ul > li:hover ul {
display: block;
height: auto; /* Height set to auto for the transition to take effect */
position: absolute;
}
.menu ul ul li{
width: 200px;
height: 40px;
line-height: 40px;
border-bottom: 1px solid #a0a0a0;
}
</style>
</head>
<body>
<div class="menu">
<ul>
<li class="newbox">Home
<ul>
<li>City Home</li>
<li>Country Home</li>
</ul>
</li>
<li class="newbox">About
<ul>
<li>About Me</li>
<li>About others</li>
<li>About my family</li>
</ul>
</li>
<li class="newbox">Contact
<ul>
<li>Contact Me</li>
</ul>
</li>
</ul>
</div>
</body>
</html>
감사
여전히 작동하지 않습니다. 도와주세요! – Bharat