Tips, Tutorials & Inspiration

Divi Vertical Menu Layouts: How to Build One with CSS

by Shahzad Raza | Nov 23, 2026

The complete Divi design library for faster websites

$297 $159.95 lifetime · unlimited client sites

The fastest way to build divi vertical menu layouts is to add a CSS class to a standard Menu module and stack its items with about 20 lines of CSS. For a full-height sidebar, put that same menu inside a fixed-position section of a Theme Builder global header. If you would rather not touch code, a third-party vertical menu module does the same job from a settings panel. All three routes work in Divi 4 and Divi 5.

The catch is that Divi has no vertical option. The Menu module lays items out in a row, and at 980px and below it collapses into a hamburger icon. A stacked list in a footer or sidebar fights the module at every step. Submenus fly out over your content, tall menus run off the screen, and page content slides under a fixed sidebar. Most tutorials fix one of these problems and leave you with the rest.

This guide takes the problems in order. You will pick an approach, scope the menu with a class, stack it, build the sidebar header, make submenus open on click, and fix tablet and phone behavior. Divi Hat designs layouts and child themes for Divi professionals, so every step is written for client work: reusable, scoped to one menu, and safe for the rest of the site.

Why Divi has no vertical menu and what to use instead

Divi has no vertical menu setting because the Menu module is built as a horizontal row that swaps to a hamburger dropdown at 980px and below. Every vertical layout is an override of that behavior, which is why a small, scoped piece of CSS is the standard solution.

How the Menu module behaves

The module outputs a nav with a ul of items and lays them out side by side. Below 980px it hides that list and shows a mobile dropdown instead. A vertical menu has to do three jobs: stack the items, keep the list visible on small screens, and control where submenus open.

You also need to limit your CSS to one menu. If you write rules against the module’s default classes, your header menu changes too. Give the vertical menu its own class and prefix every rule with it.

Scope every vertical menu to its own CSS class so the rest of your site keeps its normal header.

Pick the right approach

Choose by where the menu lives and how much code you are willing to maintain. The table sets the four common routes side by side.

Approach Best for Effort Main trade-off
CSS class on the Menu module Footers, sidebars, in-page link lists Low: one class and one snippet You maintain the CSS
Fixed side header in Theme Builder Site-wide left navigation Medium: section settings plus CSS Needs a separate tablet and phone header
Vertical menu plugin or module Teams that want a settings panel Low One more plugin to update and check for Divi 5 support
Text module with links Tiny static link lists Lowest Does not follow your WordPress menu

For most client sites, start with the CSS class. It is free, it reads your normal WordPress menu, and it covers footers and sidebars. Step 3 adds the fixed sidebar when you need one.

What to have ready

A few minutes of setup saves debugging later. Check this list before you start:

  • Divi 4 or Divi 5, running the theme or the Divi Builder plugin.
  • A menu built in Appearance > Menus with a few items, ideally one parent with children so you can test submenus.
  • A home for the CSS. A child theme’s style.css is the cleanest. Divi > Theme Options > General > Custom CSS also works.
  • A staging copy or a fresh backup, because header changes show on every page.
  • Your browser’s inspector, so you can check class names if a rule does not apply.

Step 1. Prepare the menu and add a CSS class

Build or confirm the menu in WordPress, add a Menu module where you want it, and give that module the CSS class dh-vmenu. That class is the hook every later rule uses, so only this menu turns vertical.

Build the menu in WordPress

Go to Appearance > Menus and create the menu. Keep top-level items to a number that fits on screen, and put the rest under parents. If a parent item should only open its submenu and not load a page, add it as a Custom Link with the URL #. The click script in Step 4 treats those links as toggles.

Name the menu after its job, such as "Sidebar menu" or "Footer links". Divi’s Menu module can then pick it from a dropdown without confusion.

Add the class to the Menu module

Add a Menu module to a column. In its Content tab, choose your menu under the menu selector. Then add the class:

  • Divi 5: Advanced > Attributes > Add Attribute > CSS Class.
  • Divi 4: Advanced > CSS ID & Classes > CSS Class.

Type dh-vmenu without a dot. The Divi 5 Menu module keeps the class names that Divi 4 used, such as et_pb_menu__menu, et_mobile_nav_menu, and sub-menu. The CSS in this guide therefore works in both versions. If a rule fails, inspect the menu in your browser and check that those names exist on your site.

The class goes on the module, not the column or the row, or none of the selectors in this guide will match.

Step 2. Stack the items with CSS

Paste the base CSS below to turn the row into a vertical list that stays visible on every screen width. It does three things: it forces the wrappers to block layout, it hides the hamburger, and it turns each top-level link into a full-width button.

Paste the base CSS

Every selector starts with .dh-vmenu, so nothing else on the site changes. Change the colors to match your brand.

/* 1. Stack the menu and keep it visible on every screen width */
.dh-vmenu.et_pb_menu .et_pb_menu_inner_container,
.dh-vmenu.et_pb_menu .et_pb_menu__wrap,
.dh-vmenu.et_pb_menu .et_pb_menu__menu,
.dh-vmenu.et_pb_menu .et_pb_menu__menu > nav,
.dh-vmenu.et_pb_menu .et_pb_menu__menu > nav > ul {
  display: block;
  width: 100%;
}

/* 2. Hide the hamburger version */
.dh-vmenu.et_pb_menu .et_mobile_nav_menu {
  display: none;
}

/* 3. Make each top-level item a full-width block */
.dh-vmenu .et-menu > li {
  display: block;
  width: 100%;
  margin: 0 0 8px;
  padding: 0 !important;
}

/* 4. Style the links */
.dh-vmenu .et-menu > li > a {
  display: block;
  padding: 12px 16px;
  line-height: 22px;
  text-align: left;
  background: #f4f5f7;
  border-radius: 6px;
}

/* 5. Hover and current page */
.dh-vmenu .et-menu > li > a:hover,
.dh-vmenu .et-menu > li.current-menu-item > a {
  opacity: 1;
  color: #ffffff;
  background: #1f2a44;
}

The first rule uses .dh-vmenu.et_pb_menu on purpose. It is specific enough to beat Divi’s own rule that hides the link list at 980px and below. The text-align: left line matters too, because the Menu module can right-align text on tablets and phones.

Prefixing rules with the module’s own class plus .et_pb_menu is what keeps the menu visible below 980px.

Where to put the CSS

You have three places to put the snippet, and the right one depends on how many sites you build.

For a single site, use Divi > Theme Options > General > Custom CSS. For client work, put it in a child theme’s style.css so it survives theme updates and travels with the site. The third option is a Code module on the page, wrapped in <style> tags. That suits a one-off page, but the CSS then loads only there.

Optional: hover flyout submenus

If you want submenus to fly out to the right on hover, add these rules. Skip them if you plan to use click-to-open submenus in Step 4, because the two styles conflict.

.dh-vmenu .et-menu > li { position: relative; }

.dh-vmenu .et-menu li ul.sub-menu {
  top: 0 !important;
  left: 100% !important;
}

A flyout extends outside its parent, so every wrapper around the menu needs overflow set to visible. In the section, row, and column settings, open Advanced > Visibility and set both overflow options to Visible. If a submenu appears cut off, an overflow setting on one of those parents is almost always the cause.

Step 3. Build a fixed sidebar header

To make the menu a full-height left sidebar, build a Theme Builder global header with one fixed section 300px wide, put the menu module inside it, and push the page content 300px to the right. Use this for site-wide vertical navigation. For a footer or in-page list, Step 2 is enough.

Create the global header

Follow these steps in order:

  1. In the WordPress dashboard, go to Divi > Theme Builder.
  2. On the Default Website Template, click Add Global Header and choose Build Global Header.
  3. Choose Build from Scratch.
  4. In the layout editor, open the settings of the default section. You will set it up in the next part.
  5. Inside the section, add a one-column row, then add a Menu module with your logo and your menu. Add the dh-vmenu class as in Step 1.

Set the row to full width inside the section, with zero side padding. Otherwise your buttons shrink to the default 80% row width and look narrow.

Turn the section into a fixed sidebar

Open the section settings and apply the values below. Also add the class dh-side-header to the section. Step 5 uses it.

A desktop monitor showing a narrow sidebar of stacked buttons on the left and a wide page area.

Setting Where Value
Width Design > Sizing 300px
Height Design > Sizing 100vh
Position Advanced > Position Fixed, top left, 0 offsets
Z index Advanced > Position 9999
Overflow Advanced > Visibility Visible, both axes
Padding Design > Spacing 32px top and bottom, 20px left and right
Visibility Advanced > Visibility Disable on tablet and phone

The last row is deliberate. A fixed 300px panel on a phone covers the screen and pushes the page content under it. A common complaint about this layout is a wall of white at the top of mobile pages. You will replace the sidebar on small screens in Step 5.

Make room for the page content

A fixed element leaves the page flow, so the content slides underneath it. Push the main area over with a rule that only applies on desktop. Add it to Theme Options > General > Custom CSS or your child theme.

@media (min-width: 981px) {
  #et-main-area {
    margin-left: 300px;
  }
}

Here is the arithmetic for a common screen. On a 1440px-wide browser window, the sidebar takes 300px and the page content gets 1140px. The footer sits inside the same area, so it moves over too. Save the layout and the template, then check a page on the front end.

A fixed sidebar needs two things: a 300px section and a 300px margin on the main area, and only above 980px.

Step 4. Make submenus open on click

For vertical menus, click-to-open submenus beat hover flyouts. They stay inside the sidebar, work on touch screens, and let you scroll tall menus. The recipe is a short block of CSS to hide and reposition submenus, plus a few lines of jQuery that add a toggle button.

Add the submenu CSS

This block hides every submenu, moves it into the normal flow under its parent, and draws a chevron toggle with plain CSS so you do not depend on an icon font. Add it below the base CSS from Step 2 and leave out the optional flyout rules.

/* Submenus: hidden by default and inside the menu flow */
#page-container .dh-vmenu ul.sub-menu {
  position: static;
  visibility: visible;
  opacity: 1;
  display: none;
  width: 100%;
  padding: 4px 0 0 16px !important;
  background: transparent;
  border-top: 0;
  box-shadow: none;
}
#page-container .dh-vmenu ul.sub-menu li {
  display: block;
  width: 100%;
  margin: 0 0 4px;
  padding: 0 !important;
}
#page-container .dh-vmenu ul.sub-menu li a {
  display: block;
  width: 100%;
  padding: 10px 16px;
  background: #fafafa;
  border-radius: 6px;
}

/* Remove Divi's own arrow and draw a toggle */
.dh-vmenu .menu-item-has-children > a:first-child::after { display: none; }
.dh-vmenu li { position: relative; }
.dh-vmenu .dh-toggle {
  position: absolute;
  top: 0;
  right: 0;
  width: 46px;
  height: 46px;
  cursor: pointer;
  z-index: 2;
}
.dh-vmenu .dh-toggle::before {
  content: "";
  position: absolute;
  top: 16px;
  left: 18px;
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.2s ease, top 0.2s ease;
}
.dh-vmenu li.dh-open > .dh-toggle::before {
  top: 22px;
  transform: rotate(-135deg);
}
.dh-vmenu ul.sub-menu .dh-toggle { width: 42px; height: 42px; }
.dh-vmenu ul.sub-menu .dh-toggle::before { top: 14px; left: 16px; }
.dh-vmenu ul.sub-menu li.dh-open > .dh-toggle::before { top: 20px; }

The submenus use display: none, so Divi’s hover rule, which only changes visibility and opacity, can no longer open them. Only the toggle does. The toggle is 46px tall because the top-level links are 12px padding, a 22px line, and 12px padding. If you change the link padding, change the toggle height to match.

Add the jQuery

The script inserts a toggle before each submenu and slides the submenu open or closed on click or tap. Paste it into a Code module on the page, or into Divi > Theme Options > Integration, in the "Add code to the body" field, to use it on every page.

<script>
jQuery(function ($) {
  var $menu = $('.dh-vmenu');

  // Divi binds its own touch handler to parents. Remove it so one tap toggles.
  $menu.find('.menu-item-has-children').off('touchend');

  $menu.find('ul.sub-menu').before(
    '<span class="dh-toggle" role="button" tabindex="0" aria-label="Show submenu"></span>'
  );

  $menu.on('click', '.dh-toggle, li.menu-item-has-children > a[href="#"]', function (e) {
    e.preventDefault();
    var $item = $(this).closest('li');
    $item.children('ul.sub-menu').slideToggle(200);
    $item.toggleClass('dh-open');
  });

  $menu.on('keydown', '.dh-toggle', function (e) {
    if (e.key === 'Enter' || e.key === ' ') {
      e.preventDefault();
      $(this).trigger('click');
    }
  });
});
</script>

Without the touchend line, a phone user taps once to reveal the dropdown and a second time to follow the link. Parent items saved as a custom link with # open their submenu on a click on the label itself, because the click handler also matches them.

Test every level

Open the page, click each toggle, and check that the chevron flips and the submenu slides. Then test a third level if your menu has one. Nested submenus use the same toggle, so they work without extra code, but you may need to nudge the chevron position with the top values in the CSS.

A stack of menu bars with one expanded to show three indented submenu bars and chevron arrows.

Hiding submenus with display: none and opening them with a toggle is what turns a hover dropdown into a click accordion.

Step 5. Fix tablet, phone, and tall menus

Most vertical menu problems show up outside the desktop view. The fix is to give tablet and phone a normal horizontal header, and to let the sidebar scroll when the menu is taller than the screen.

Swap in a standard menu on small screens

Your sidebar section is disabled on tablet and phone, so those screens need their own header. In the same global header, add a second section with a standard Menu module and your logo. Do not give it the dh-vmenu class. Then open its visibility settings and disable it on desktop.

A monitor with a vertical sidebar menu next to a smartphone with a top bar and hamburger icon.

The result is two sections that never show together. Desktop gets the fixed sidebar, and tablet and phone get Divi’s regular hamburger header. If you want parent items in that hamburger dropdown to expand and collapse, check the Menu module’s Design tab in Divi 5 for the Collapsible Mobile Menu option. It covers only the mobile dropdown, which is exactly where you need it here.

Handle menus taller than the screen

A fixed sidebar cannot scroll the page, so a long menu gets cut off. Work out the height before you design. With the Step 2 styling, each top-level item takes 54px (46px of link plus 8px of margin). Twelve items take 648px. Add about 120px for a logo and a button, and you reach 768px, which is taller than the visible area of many laptop browser windows.

Let the section scroll instead. Add this rule, which uses the dh-side-header class from Step 3:

@media (min-width: 981px) {
  .dh-side-header {
    overflow-y: auto !important;
    overflow-x: hidden !important;
  }
}

This only works with the click-to-open submenus from Step 4. A scrolling container clips hover flyouts, so use the accordion style whenever you turn scrolling on.

Troubleshoot the usual symptoms

Check the symptom in this table before you rewrite any code.

Symptom Likely cause Fix
Menu is still horizontal Class missing or mistyped, or CSS not loading Check dh-vmenu on the module, then clear caching plugins
Hamburger appears below 980px A rule lost on specificity Keep the .dh-vmenu.et_pb_menu prefix on the first two rules
Submenu is cut off Overflow hidden on a parent Set section, row, and column overflow to Visible
Links jump right on phones Text alignment default Keep text-align: left on the links
Content hidden behind the menu Margin rule missing or wrong breakpoint Check the #et-main-area rule and the 981px media query
Toggle does nothing Script not loaded, or no submenu in the menu Confirm the script’s location and that the parent has children

If a vertical menu works on desktop and breaks on phones, the answer is almost always a second, standard header for small screens.

Extras: layout variations and plugin options

Once the base menu works, you can reuse it for footers, in-page sidebars, and a right-side layout, and you can decide whether a plugin saves you time. The same dh-vmenu class and CSS cover all three layouts without new code.

Footer and sidebar link lists

For a footer, add a Menu module to a footer column and give it the class. The base CSS from Step 2 is enough, and you can skip the sidebar section entirely. For a sidebar inside a page, put the module in a narrow column beside your content. Because the CSS makes the menu fill its column, the column width sets the menu width. If the CSS works on a normal page but not in a Theme Builder footer, add #page-container in front of the selectors to raise their specificity.

Footer menus rarely need submenus, so leave out the Step 4 script there. Fewer scripts mean faster pages.

A right-side vertical menu

To mirror the sidebar, change the section’s position to fixed with a top right location, and swap the margin rule to margin-right: 300px on #et-main-area. Hover flyouts open to the right by default and would run off-screen, which is why people report dropdowns that vanish or hide behind the page when they move the menu to the right. Use the click-to-open accordion from Step 4 and the problem disappears.

Plugins and modules

If you do not want to maintain CSS, a vertical menu module is a reasonable shortcut. The DiviFlash Vertical Menu Module is marketed for custom sidebars, mega menus, and footers with advanced styling options. The Divi Plugins vertical menu module loads a WordPress menu into a vertical button layout, with buttons that inherit your theme’s style and can be overridden.

Weigh three things before you install one. It adds another plugin to update. You should confirm on the product page that it supports Divi 5 if you use it. And the styling lives in the plugin, so moving a design to another site means installing the plugin there too. For agencies, the CSS approach is easier to reuse. After you finish a header, export the template with the portability icon in Divi > Theme Builder and import it on the next project.

Use CSS when you want one menu pattern across many client sites, and a plugin when you want a settings panel on one.

Putting your vertical menu to work

A vertical menu in Divi comes down to a scoped class, a short stylesheet, and a decision about submenus. Use the CSS class alone for footers and sidebars, add a fixed Theme Builder section for site-wide navigation, and open submenus on click so tall menus can scroll. Give tablet and phone their own standard header, and the layout holds up everywhere.

If you build Divi sites for clients and want the surrounding pages ready too, the Divi Hat membership gives you layouts, child themes, wireframes, and hero sections that import into the Divi Library and stay editable in the Visual Builder. Add your vertical menu to any of them, and you can launch the next site faster.

Pick your plan. Keep every design.

Both plans unlock the full library. Lifetime pays for itself after your second client site.

YEARLY MEMBERSHIP

Standard

Regular price $129

$79.95

/ year

Renews yearly. Cancel anytime.

Access to all products

Compatible with Divi 5

All Divi child themes

All Divi layouts & wireframes

All Divi hero sections

Unlimited sites usage

Priority support

BEST VALUE · SAVE 46%

Lifetime Deal

Regular price $297

$159.95

once

Pay once. No renewals, ever.

Everything in Standard

Lifetime access, no renewals

All future products included

Unlimited sites & client projects

Royalty-free images

Priority chat & email support

Divi 5 and Divi 4 compatible

30-day money-back guarantee

Secure checkout via Lemon Squeezy

·

Cards & PayPal accepted

·

Works with the WordPress Divi Theme. Don't have it?

Get Divi here.

Try Our Layouts for Free

Free Divi Layouts to Kickstart Your Next Website