Moritz Reitz
← Back to blog

Dynamic breakpoint oxygen builder menu element

Add a dynamic breakpoint to your horizontal navigation menu in Oxygen Builder — a simple CSS flexbox fix that wraps menu items on mobile devices.

27 April 2024 · Moritz Reitz

This article explains why the oxygen menu items does not wrap it's children into a new row when they are overflowing the screen. To understand this article you will require a basic understanding on flex-box. You can watch this video by Kevin Powell or read about flexbox on the MDN Docs.

The 'issue' with the native menu in oxygen

The Oxygen menu's ol element is set up as a flex-box, but does not contain a 'flex-wrap:wrap', which allows flex elements that would horizontally overflow

  1. Create a stylesheet in Oxygen Builder
  2. Add this code to your style sheet:


  3. /*Target ul selector of the relevant menu class swap .menu--footer for relevant menu class or #selector*/
    .menu--footer ul {
    flex-wrap:wrap;
    }

    /*Target li selector withing the list targeted above swap .menu--footer for relevant menu class or #selector*/
    .menu--footer ul li{
    width: fit-content !important;
    }
  4. Apply the class '.menu--footer' to your menu element in the Oxygen editor
responsive horizontal oxygen builder navigation menu
responsive horizontal oxygen builder navigation menu

This is a quick CSS-only fix that doesn't require any JavaScript or Oxygen Builder settings change. The same flexbox wrapping principle applies if you're building menus in other page builders. If you're also dealing with plugin stylesheet conflicts, my post on removing plugin stylesheets in WordPress covers how to cleanly dequeue unwanted CSS. For help with WordPress website builds and custom front-end development, take a look at my WordPress development services.

FAQ

Why don't Oxygen Builder menu items wrap to a new row on smaller screens? Oxygen's native menu uses a flexbox `
    ` element but doesn't include `flex-wrap: wrap` by default. Without it, flex items can't overflow onto a new line — they'll either clip off-screen or get compressed. Adding `flex-wrap: wrap` to the `ul` selector and `width: fit-content !important` to the `li` selector fixes this with pure CSS and no JavaScript required.
How do I target only one specific menu in Oxygen Builder with this CSS fix? Add a custom class to your menu element in the Oxygen editor (e.g. `.menu--footer`) and scope the CSS to that class: `.menu--footer ul { flex-wrap: wrap; }` and `.menu--footer ul li { width: fit-content !important; }`. This keeps the fix isolated to that menu and avoids accidentally affecting other navigation elements on the page.
Does this flexbox fix work for both header and footer menus in Oxygen Builder? Yes — the same `flex-wrap: wrap` approach works for any horizontally-laid-out menu in Oxygen. Just apply a different class to each menu and scope your CSS accordingly. For header menus you may also want to set a `min-width` on the `li` items to prevent them from wrapping too aggressively at mid-range viewport widths.

Work with me

Found this helpful?

Get in touch if you need help with your website, SEO, or paid advertising — I offer a free initial consultation.