Tidy Up Your Shopify Desktop Menu: A Community Fix for Full-Width Dropdowns
Hey everyone! As a Shopify migration expert and someone who spends a lot of time diving into the community forums, I often see store owners grappling with similar design challenges. Recently, a thread popped up that perfectly illustrates how a seemingly small CSS tweak can make a huge difference in the desktop user experience. It was all about taming those sprawling, full-width mega-menu dropdowns.
Our fellow merchant, @veluxe1, kicked off the discussion with a common pain point: their desktop menu dropdown was taking up the entire screen width. While mega-menus are fantastic for displaying lots of options, a full-width presentation can sometimes feel clunky and less refined than a more compact, card-like dropdown. Veluxe1 was specifically looking to reduce this width for a cleaner look, but only for desktop users. Here's a glimpse of what they were seeing:
The Quest for a Cleaner Look
The thread saw a few good attempts from community members like @Steve_TopNewYork and @shopplaza_team, who provided various CSS snippets. They correctly identified the need for media queries (@media screen and (min-width: 990px)) to target only desktop layouts, ensuring mobile navigation remained untouched. They also started to tackle properties like width, max-width, left, and transform to control the dropdown's positioning and size.
However, as is often the case with custom CSS, it can be a bit of a dance to get it just right across different themes. Veluxe1 clarified that even with some of the initial suggestions, the menu either remained full-width or, when the main menu was repositioned (e.g., to the left with the logo centered), the submenu didn't follow suit and stayed centered. This highlighted the importance of precise targeting and understanding the theme's underlying structure.
The Breakthrough: A Theme-Specific Solution
This is where @ajaycodewiz stepped in with a fantastic, precise solution. By taking the initiative to install the Horizon theme (which they correctly guessed Veluxe1 was using), they were able to reproduce the exact problem and craft a tailored fix. Their insight was key: the Horizon theme's submenu panel (.menu-list__submenu) was inherently set to span full width (position: absolute; width: 100%; left: 0).
Ajay's solution not only reduced the width but also anchored the dropdown directly under its parent menu item, giving it that clean, compact "dropdown-card" appearance. Here’s what the final, polished menu looks like:
Step-by-Step: Implementing the Fix
If you're using the Horizon theme (or a similar theme with full-width mega-menus) and want to achieve this more compact dropdown look, here are the instructions based on Ajay's solution:
- Access Your Theme Code: From your Shopify admin, go to Online Store → Themes. Find your current theme, click the Actions button, and then select Edit code.
- Locate Your CSS File: In the theme editor, navigate to the
assetsfolder and open thebase.cssfile. (Some themes might usetheme.cssor another similar stylesheet, butbase.cssis a common spot for global styles). - Paste the CSS Code: Scroll to the very bottom of the
base.cssfile and paste the following code. This ensures your custom styles override any default theme styles.
/* Compact desktop mega-menu dropdown (Horizon). Desktop only - mobile drawer untouched. */
@media screen and (min-width: 990px) {
/* anchor each dropdown to its own menu item */
.menu-list__list-item { position: relative; }
/* shrink the panel from full-width to a compact dropdown under the item */
.menu-list__list-item:not([slot='overflow']) > .menu-list__submenu {
width: max-content !important;
max-width: min(90vw, 320px) !important;
left: 0 !important;
right: auto !important;
top: 100% !important;
padding-inline: 0 !important;
clip-path: none !important;
}
/* size the content to itself and stack the links vertically */
.menu-list__list-item:not([slot='overflow']) > .menu-list__submenu .mega-menu,
.menu-list__list-item:not([slot='overflow']) > .menu-list__submenu .mega-menu__grid { width: 100% !important; }
.menu-list__list-item:not([slot='overflow']) > .menu-list__submenu .mega-menu__grid { display: block !important; }
.menu-list__list-item:not([slot='overflow']) > .menu-list__submenu .mega-menu__link { display: block !important; }
/* give it a proper dropdown-card look */
.menu-list__list-item:not([slot='overflow']) > .menu-list__submenu .menu-list__submenu-inner {
transform: none !important;
padding: 14px 22px !important;
background: var(--color-background, #fff);
border: 1px solid rgb(var(--color-foreground-rgb) / 0.08);
border-radius: 10px;
box-shadow: 0 10px 30px rgb(var(--color-foreground-rgb) / 0.14);
}
}
Breaking Down the Code
- The
@media screen and (min-width: 990px)ensures these changes only apply to screens wider than 990 pixels, preserving your mobile menu. .menu-list__list-item { position: relative; }is crucial here. It makes each main menu item a reference point, so the dropdown (which isposition: absolute) can be accurately positioned directly beneath it.width: max-content !important;andmax-width: min(90vw, 320px) !important;shrink the dropdown to fit its content, with a maximum width of 320 pixels (or 90% of the viewport width, whichever is smaller). You can adjust320pxto your desired maximum width.left: 0 !important;andtop: 100% !important;position the dropdown exactly at the left edge and directly below its parent menu item.- The styles for
.menu-list__submenu-innercreate that nice "card" effect with a background, border, border-radius, and subtle box-shadow, making it look much more integrated and less like a full-screen overlay.
It's worth noting that the use of !important is common in these types of quick fixes to ensure the styles override existing theme declarations. While generally advised against in large-scale development, for specific overrides like this, it often gets the job done efficiently.
This whole discussion really highlights the power of the Shopify community. When one merchant shares a challenge, others jump in with ideas, code snippets, and even deeper investigations into theme specifics. It's a fantastic way to refine your store's design without needing to be a full-time developer. So, if you're looking to start your own online store or migrate to a more flexible platform, remember that the Shopify platform offers not just powerful tools, but also a vibrant, helpful community ready to assist with these kinds of detailed customizations. Give this CSS a try, and enjoy a tidier, more professional desktop menu on your store!

