我認爲你做了幾個錯誤。
/* First of all it's better to have your list-item relative. */
nav ul > li {
position:relative;
}
/* Then your .on-hover can have simpler top and left coordinates. */
.on-hover {
height: 150px;
background-color: rgb(243,243,241);
width: 165px;
position: absolute;
left: 0;
top: 0;
display: none;
border-bottom: 1px solid rgba(96, 96, 96, 0.2);
z-index: -1;
}
/* You want the hovering to be over the entire li.*/
nav ul > li:hover .on-hover {
display: block;
}
你有這樣的懸停工作。這意味着它停止,當你離開#TEST是錨徘徊(<a>
)元素
#test:hover + .on-hover {
工作的jsfiddle:https://jsfiddle.net/3su9jppc/1/
你能把它會更容易小提琴,以幫助 – KoKo
這裏是:) HTTPS ://jsfiddle.net/hv2a18y7/ – MaieonBrix