WordPress.org

Forums

Quick CSS Queston regarding sub menu. Keeps dissapearing. (2 posts)

  1. tenthoughts
    Member
    Posted 1 year ago #

    Hi there,

    Hope this finds you well. I am updating a client's site. The custom theme their former coder developed does not have the necessary code to support sub menus. I need to add the propper css to style.css so the sub menu does not live permanent under the menu.

    I would like be able to hover the word in the menu, then below the options appear, you click, the go to child page.

    Below is my css which is a little messy as I took it from various sites and put it together when testing. This makes the menu appear on hover but it dissapers when you take mouse away from the word in the menu. How do I keep the menu present until action is determined? Wht is the only code I need for this? Perhaps this code is conflicting with itself....

    Thank you so much for your help. Nick

    My css:
    ---------------------------------------

    .menu li {
    position: relative;
    }

    .menu .sub-menu {
    display: none;
    position: absolute;
    left:0;
    text-align: left;
    margin:0;
    width: 150px;
    }

    .menu .sub-menu .li {
    padding:0;
    }

    .menu li:hover > .sub-menu {
    display: block;
    position: absolute;
    top: 20px;
    padding-left: 0;
    background-color: #fff;
    width: 200px;
    }

    ---------------------------------------

  2. Andrew
    Forum moderator & snail smusher
    Posted 1 year ago #

    We really can't suggest anything accurate without seeing the site.

Topic Closed

This topic has been closed to new replies.

About this Topic