Keeping dropdown menu active (visible) even after hover out

前端 未结 4 477
滥情空心
滥情空心 2021-01-07 05:53

My sub menu disappears immediately after I move my mouse pointer to scroll towards the sub menu. Feel like I have screwed my CSS somewhere. I could not figure out after seve

4条回答
  •  有刺的猬
    2021-01-07 06:27

    Put the padding on your list items instead of your ul or container. That way the dropdown overlaps your hover element and your browser never thinks that you hovered out of the element. See this:

    #topnav li {
        display:inline-block;
        padding:10px 0;
        margin-right:30px;
        position: relative;
    }
    

    http://jsfiddle.net/jeffreyTang/q5cmqLrf/1/

提交回复
热议问题