PURE CSS DROP DOWN MENU - Unable to keep top
  • highlighted when hovering over sub-menu
  • 后端 未结 3 944
    清酒与你
    清酒与你 2021-01-02 09:09

    I have a drop down menu in only CSS and no JAVASCRIPT and I\'m having a problem keeping the top (main menu item) highlighted when I move the cursor over the sub menu items.

    3条回答
    •  清歌不尽
      2021-01-02 09:31

      You're currently setting the hover state on the A tag, you need to (also) set it on the LI tag. When you are over a child UL, you are no longer over the A, but you are still over the LI. Try this:

      #nav li hover {
      background-color:#F4F4F4;
      color:#543056;
      

    提交回复
    热议问题