Shopify Menu Makeover: Ditch the Block Hover & Fix Your Mega Menu with Custom CSS

Hey there, fellow store owners! You know how it goes – you've got a vision for your Shopify store, but sometimes those little design tweaks, especially around navigation, can feel like a real hurdle. I recently saw a fantastic discussion in the Shopify Community forums that tackled a common pain point: menu customization. It was so insightful, I just had to share!

Our community member, shaunjones76, was running the Testament theme and wanted to refresh their navigation. Their main gripes were pretty common: an "outdated Block look on hover" on their dropdown menu, where they preferred just the text to change color. Plus, their mega menu was a mess with black text on a black background (completely unreadable!), and an "ugly looking Line" under the titles that needed to go.

First Stop: The Theme Customizer

Before diving into any code, always check your theme's built-in customization settings. As emilyjhonsan98 reminded us, many themes offer direct controls for these changes.

Quick Menu Color Adjustments (No Code Needed):

  1. Head to your Shopify admin: Online Store > Themes.
  2. Click Customize for your current theme.
  3. In the customizer, look for Header or Navigation settings on the left sidebar.
  4. Find the Colors panel.
  5. For your main menu hover effect, try setting the Menu Hover Background to transparent or match your page background.
  6. Then, set the Menu Hover Text to your desired accent color.
  7. For mega menu visibility, find the Mega Menu / Dropdown color section.
  8. Change the Dropdown Background to a light color (e.g., white) and ensure Dropdown Text is a dark, contrasting color (e.g., black).

This is your ideal first step. If your theme provides these options, you're golden! However, as shaunjones76 found, sometimes themes (especially older versions) don't offer the specific granular control you need. That's when custom CSS becomes your powerful ally.

When Custom CSS is Your Powerful Ally

When theme settings aren't enough, custom CSS allows you to override default styles for precise control. SectionKit's advice to "Use browser DevTools to find the exact class name" is crucial here – it helps you pinpoint exactly what to target.

Adding Custom CSS to Your Shopify Theme:

When asking for help in the community, it's often useful to provide a preview link to your theme, especially if you're experimenting with a duplicate. This screenshot from tim_tairli illustrates how to generate such a link:

Screenshot showing how to get a theme preview link

Now, for adding the code:

  1. From your Shopify admin, go to Online Store > Themes.
  2. Important: Always Duplicate your live theme first as a backup before editing code!
  3. Click Actions > Edit Code on your duplicated theme.
  4. In the code editor, navigate to the Assets folder. Open a main CSS file like theme.scss.liquid, base.css, or custom.css.
  5. Scroll to the very bottom of this file and add your custom CSS snippets. This ensures your styles take precedence.
  6. (Alternative for quick tests): You can also add CSS directly to theme.liquid (under Layout), just before the closing tag, wrapped in tags.

The Community-Powered Solutions

Here are the specific CSS snippets that helped shaunjones76, largely thanks to tim_tairli's fantastic contributions!

1. Removing the "Block Look" on Hover:

To eliminate that block background on hover and have only the text change color, these rules are key. Moeed initially offered a solution that showed a block background (as seen here), but shaunjones76 wanted it removed:

Example of block hover effect

Here's the code that achieves the desired transparent background:

ul#main-nav li:hover {
  background: transparent !important;
}

ul#main-nav li ul.submenu li:hover {
    background: inherit !important;
}

The !important flag ensures these styles override existing ones. transparent makes the main menu item background invisible, while inherit for submenus tells them to adopt their parent's background (which, if also transparent, achieves the same effect).

2. Changing Hover Text Color & Adding a Smooth Transition:

With the block background gone, you'll want your text to change color on hover. If your theme doesn't do this automatically or you want a specific color, add this:

ul#main-nav li a:hover {
    color: #FF6B6B !important; /* Change to your desired hover text color */
}

To make this color change look polished and modern, tim_tairli suggested a subtle transition:

nav a {
  transition: color 0.15s ease-in;
}

This creates a smooth fade effect, significantly enhancing user experience.

3. Taming the Mega Menu: Visibility and Aesthetics

Fixing the mega menu's black-on-black text and that "ugly line" was also addressed:

Removing the Line Under Mega Menu Titles:

This simple snippet makes that border disappear:

ul.megamenu h4 {
  border: none;
}

Ensuring Mega Menu Text Visibility:

If your theme customizer doesn't fix the black-on-black issue, or you need to ensure link titles are readable, tim_tairli's code helps:

.megamenu h4 a {
  color: inherit !important; /* Or set a specific dark color like #000000 */
}

Using color: inherit !important; means the link text will adopt the color of its parent, which should make it visible if the mega menu background is light. You can also explicitly set a color like #000000 for black.

This community discussion perfectly illustrates the power of shared knowledge. What started as a frustrating design challenge for one store owner quickly led to clear, actionable solutions thanks to collective expertise. Remember, the Shopify community is an incredible resource, and with a little custom CSS (and maybe some DevTools magic), you can truly make your store's design shine. Happy customizing!

Share:

Use cases

Explore use cases

Agencies, store owners, enterprise — find the migration path that fits.

Explore use cases