Title: how to make a CSS drop-down menu without javascript
Last modified: August 21, 2016

---

# how to make a CSS drop-down menu without javascript

 *  Resolved [jessicalane](https://wordpress.org/support/users/jessicalane/)
 * (@jessicalane)
 * [13 years ago](https://wordpress.org/support/topic/how-to-make-a-css-drop-down-menu-without-javascript/)
 * Hi,
 * I’ve inherited a website with a custom theme, that has a simple top bar navigation.
   when you hover over the menu items, a drop down list appears. However this uses
   javascript, and i’d like it to function without for those users who disable javascript.
 * I’ve got it to the point where (i think) it should be working, but it isn’t! 
   the top level displays correctly but hovering has no effect- the drop down menu
   items aren’t appearing.
 * My question is, is there a mistake with the following code, or is it correct 
   but i need to change something somewhere else?
 * Thank you in advance!
 * (my main menu is registered as primary)
 * code in header:
 *     ```
       <div id="linkbar-wrapper">
       <?php wp_nav_menu( array( 'container_class' => 'linkbar', 'theme_location' =>   'primary' ) ); ?>
       </div>
       ```
   
 * code in style sheet:
 *     ```
       #linkbar-wrapper .linkbar #menu-main-menu li a
       {margin-top:95px;
       color:white;}
       #linkbar-wrapper .linkbar #menu-main-menu li a
       {padding-right:40px;}
   
       #linkbar-wrapper .linkbar #menu-main-menu li ul li a
       {display:none;
       padding:0;
       margin:0;}
       #linkbar-wrapper .linkbar #menu-main-menu li:hover ul li a
       {display:block;
       padding:0;
       margin:0;}
       ```
   
 * There’s only one .js file for this site and i’ve commented out the section that
   refers to navigation as i’d like to do this without any javascript.
 * I’m afraid i can’t link to the site as i’m working on a local host!
 * Thanks again.

Viewing 1 replies (of 1 total)

 *  Thread Starter [jessicalane](https://wordpress.org/support/users/jessicalane/)
 * (@jessicalane)
 * [13 years ago](https://wordpress.org/support/topic/how-to-make-a-css-drop-down-menu-without-javascript/#post-3828701)
 * Issue resolved: I’d got my selectors wrong in the style sheet. It should have
   been:
 *     ```
       #linkbar-wrapper .linkbar #menu-main-menu li ul
       {display:none;
       padding:0;
       margin:0;}
       #linkbar-wrapper .linkbar #menu-main-menu li:hover > ul
       {display:block;
       padding:0;
       margin:0;}
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘how to make a CSS drop-down menu without javascript’ is closed to new
replies.

## Tags

 * [css](https://wordpress.org/support/topic-tag/css/)
 * [javascript](https://wordpress.org/support/topic-tag/javascript/)
 * [navigation](https://wordpress.org/support/topic-tag/navigation/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 1 participant
 * Last reply from: [jessicalane](https://wordpress.org/support/users/jessicalane/)
 * Last activity: [13 years ago](https://wordpress.org/support/topic/how-to-make-a-css-drop-down-menu-without-javascript/#post-3828701)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
