在第一次悬停时,下拉菜单起作用,然后您需要重新加载页面,以便它在悬停时再次退出
.navigation-item {
display: inline-block;
margin-right: 2%;
padding: 10px 0;}
.dropdown > .dropdown-link::after {
content: "";
float: right;
margin: 10px 5px;
width: 0;
height: 0;
border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-top: 10px solid #CCC;}
.dropdown .dropdown-list {
list-style-type: none;
display: block;
margin: 0;
padding: 0;
position: absolute;
width: 120px;
overflow: hidden;}
.dropdown .dropdown-link {
display: block;
width: 100%;
color: #F5F5F7;
font-size: 18px;}
.dropdown-item-link {
color: #F5F5F7;
font-size: 18px;
opacity: 0.8;}
.dropdown-item-link:hover {
opacity: 1;
text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
transition: all 0.3s ease-in-out;}
.dropdown-item-link:not(:hover) {
transition: all 0.3s ease-in-out;}
.dropdown .dropdown-item {
height: 0;
width: 100%;
overflow: hidden;
transition: all 500ms;
transition-delay: 300ms;}
.dropdown.hover:hover .dropdown-item{
height: 40px;}
.dropdown.hover:hover .dropdown-item:first-child {
padding-top: 15px;}
一切正常,只是您的子元素超出了父元素,并且您没有足够移动光标。这是您添加背景的示例
悬停是继承的