Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

CSS menu item hover color - can this be done with pure CSS?

Featured Replies

Hello,

 

I have the following drop down menu. As you can see, when you hover over an item (ie, Products), the font color becomes darker (as does the background drop down icon). However, once you then go down and hover over one of the sub menu items, the color of the main Products reverts to the light color (obviously, there is no li:hover any more).

 

So, is there a way to keep the Products darker while hovering over the sub menu?

 

Sorry if i worded that badly!

 

Cheers

Add this style

ul.menu li:hover.dropdown a {  color: #000000;
padding-right:0;
}

after ul.menu li.dropdown a { padding-right:0; }

 

It won't work in IE6 but works in IE7 and Firefox in my test.

I would have thought using some sort of ID trick might work.

 

So when the submenu links where rolled over it also changes the style of anything with a set ID.

 

Is that making sense? I'm on my lunch so no time to give examples yet.

  • Author

Add this style

ul.menu li:hover.dropdown a {  color: #000000;
padding-right:0;
}

after ul.menu li.dropdown a { padding-right:0; }

 

It won't work in IE6 but works in IE7 and Firefox in my test.

Perfect thanks a lot!

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.