Dropdown menu text breaking into two lines – need wider menu box

Topic summary

A user is experiencing text wrapping issues in a dropdown menu on a customized Dawn theme. The submenu link “Ofte stillede spørgsmål” (Frequently Asked Questions) breaks into two lines instead of displaying on one line.

Attempted Solutions (Unsuccessful):

  • Applied white-space: nowrap and width adjustments to #HeaderMenu-MenuList-2
  • Tried modifying padding, min-width, and max-width values
  • Verified correct element targeting via DevTools and proper code saving in base.css

Proposed Solutions:

Two community members offered CSS fixes:

  1. namphan’s approach: Add to component-list-menu.css:

    .list-menu--disclosure {
        width: 22rem;
    }
    
  2. Dan-From-Ryviu’s approach: Add to Custom CSS in Theme settings:

    details[open] > .header__submenu {
        width: max-content;
    }
    

    (Includes screenshot demonstration)

The discussion remains open with no confirmation of which solution worked.

Summarized with AI on October 29. AI used: claude-sonnet-4-5-20250929.

Hi Shopify Community :raising_hands:

I’m working on a customized version of the Dawn theme and have a dropdown menu in the header titled “Hjælp” (Help).

One of the submenu links – “Ofte stillede spørgsmål” (Frequently Asked Questions) – is breaking into two lines because the dropdown menu box isn’t wide enough. I want the entire link to stay on one line.

Here’s what I’ve tried (without success):

#HeaderMenu-MenuList-2 {

white-space: nowrap;

width: auto;

}

I also tried adjusting padding, min-width, and max-width, but the dropdown still doesn’t expand to fit the full text.

The correct element has the ID #HeaderMenu-MenuList-2, confirmed via DevTools. I’ve added the code to base.css and verified it’s saving properly.

How can I make the dropdown menu automatically expand to fit the longest link so nothing breaks onto two lines?

Thanks in advance :folded_hands:

– Benjamin

share your store link

https://soola.dk/products/soola-pro

1 Like

Hi @BenjaminW ,

Please go to Actions > Edit code > Assets > component-list-menu.css file and paste this at the bottom of the file:

.list-menu--disclosure {
    width: 22rem;
}

Hi @BenjaminW

Please add this code to Cutom CSS in Online Store > Themes > Customize > Theme settings.

details[open] > .header__submenu {
    width: max-content;
}