How To Build A Flexbox Header In Divi 5

by | May 21, 2026 | Etcetera | 0 comments

A header format is a structural downside ahead of this is a visible one. The emblem, navigation, icons, and CTA want a transparent dating. You want to come to a decision the place every merchandise sits, how a lot house separates it, and what adjustments on smaller monitors.

Flexbox solves that downside with format laws. In Divi 5, the ones controls reside within the Visible Builder, so you’ll be able to outline the construction visually as a substitute of writing customized CSS. Beneath, we will be able to construct two sensible Flexbox headers and display how Divi 5’s menu, canvas, and interplay equipment paintings in combination.

Table of Contents

Flexbox In Divi 5

Flexbox is a CSS format fashion for arranging pieces within a container. Pieces can take a seat in a row, stack in a column, wrap, develop, shrink, and align.

In Divi 5, Flexbox is a part of the core format machine. Sections, Rows, Columns, and Module Teams can act as flex bins. When a component turns into a flex container, its direct kids turn out to be flex pieces. That direct-child dating issues all the way through this educational.

Core Flexbox Controls

Divi 5 will provide you with visible controls for a very powerful Flexbox settings. You’ll set Format Route, Justify Content material, Align Pieces, Format Wrapping, Show Order, and Hole values. Those settings let you regulate construction, spacing, and alignment with out customized CSS.

Those controls are responsive. A desktop row can turn out to be a cellular column, and pieces can trade order at other breakpoints. That makes Flexbox splendid for headers as a result of a large navigation format can grow to be a compact cellular header with out reproduction sections.

Why Use Flexbox For Headers

Headers normally want one-dimensional format regulate. Chances are you’ll position a emblem and menu in a row, or stack cellular menu pieces in a column. Flexbox handles the ones patterns neatly.

  • Use Show Order to reorder pieces on smaller monitors.
  • Use Align Pieces: Stretch when columns want equivalent top.
  • Use Develop To Fill when an merchandise will have to use to be had house.
  • Use Shrink To Are compatible when an merchandise will have to keep compact.
  • Use Hole settings as a substitute of handbook padding between modules.
  • Use Format Wrapping when pieces wish to transfer onto a brand new line.

An important rule is unassuming: Flexbox controls the direct kids of a container. If a number of modules will have to behave like one merchandise, position them within a Module Workforce. That makes complicated headers more uncomplicated to regulate.

Extra Divi 5 Options To Lend a hand You Construct Higher Headers

Flexbox handles the format, however trendy headers additionally want dynamic navigation, off-canvas menus, and international enhancing. Those Divi 5 options lend a hand with that.

The Hyperlink And Dropdown Modules

A header with out navigation is normally simply branding. Divi 5’s Link Module will provide you with a versatile development block for customized menus. You’ll create hyperlinks manually or use Menu Loops to tug pieces from an present WordPress menu.

The usage of Menu Loops

With Menu Loops, one Hyperlink Module can repeat for every merchandise in a decided on menu. The menu textual content and URL can come from dynamic content material, which helps to keep your WordPress menu because the supply of fact. Upload, take away, or reorder menu pieces in WordPress, and the looped navigation can replace with it.

The usage of Dropdown Modules

The Dropdown Module builds on that machine. Position a Dropdown Module within a father or mother part, equivalent to a Hyperlink Module, and Divi connects the dropdown habits to that father or mother. The dropdown content material space is versatile, so you’ll be able to upload easy hyperlinks, rows, pictures, textual content, buttons, or complete mega menu layouts.

Use Dropdown Modules with care within looped menu pieces. A dropdown positioned within a loop can repeat with every looped merchandise. For easy menus, the usual Menu Module remains to be helpful. Use Hyperlink and Dropdown modules when you wish to have extra regulate.

Interactions And Canvases

A header ceaselessly wishes to turn or conceal one thing. It would open a cellular menu, seek panel, shape, or promo modal. Development the ones parts within the principle header can muddle the format, so Canvases lend a hand stay them separate.

What Canvases Do

Each web page has a Major Canvas for the principle format. Divi 5 additionally permits you to create indifferent Canvases, the place a cellular menu, popup, slide-in panel, or staging space can reside out of doors the principle web page construction.

See also  Everything You Need To Know About Divi 5’s Advanced Units

Canvases may also be native or international. A neighborhood Canvas belongs to at least one web page, whilst a International Canvas may also be reused around the website online. That makes International Canvases helpful for cellular menus as a result of you’ll be able to construct the menu as soon as and use it anyplace the worldwide header seems.

What Interactions Do

Interactions make indifferent parts interactive. You’ll upload habits within the builder with out writing JavaScript. Make a selection a Cause Tournament, equivalent to click on, hover, scroll, or viewport access. Then make a selection an Impact Motion, equivalent to appearing or hiding a component. In any case, make a selection the objective part or container that receives the impact.

For headers, that is particularly helpful. A hamburger icon can display a cellular menu Canvas, and a shut icon can conceal it once more.

Editable Theme Builder Spaces

Headers don’t exist in isolation. They take a seat above actual web page content material, and that context issues. Emblem measurement, spacing, distinction, and sticky habits are more uncomplicated to pass judgement on when the web page is visual.

Editable Theme Builder Spaces mean you can edit assigned headers, footers, frame templates, and web page content material in a single front-end builder consultation.

This is helping when development headers as a result of you’ll be able to examine the header in opposition to the hero phase beneath it and modify spacing with out leaving the web page.

International template adjustments follow all over the place that template is assigned, so overview each and every breakpoint ahead of publishing.

Ahead of You Construct: Plan The Header Construction

Ahead of opening the Visible Builder, come to a decision how the header will have to paintings on desktop, pill, and cellular. Flexbox makes format adjustments more uncomplicated, however the construct will nonetheless be cleaner if you already know which parts belong in combination and which of them will have to transfer right into a Canvas.

Map The Header Components

Get started by means of list each and every merchandise the header wishes. Maximum headers come with a emblem, navigation, CTA, social hyperlinks, seek, cart icon, touch main points, or trade hours. Then come to a decision which pieces are number one and which might be secondary. Number one pieces will have to keep visual on desktop. Secondary pieces can transfer into the cellular menu or disappear at smaller breakpoints.

  • Stay the emblem visual on each and every breakpoint.
  • Stay the principle CTA visual on desktop when it helps the web page objective.
  • Transfer lengthy navigation menus right into a cellular Canvas.
  • Transfer touch main points, hours, and social icons out of the compact cellular header.

Workforce Pieces Ahead of Styling Them

Flexbox works at the direct kids of a container, this means that construction issues ahead of styling. If an emblem and menu will have to transfer in combination, position them within a Module Workforce. If 3 touch blurbs will have to keep in combination at the left aspect of a row, position them within one crew. Then Flexbox can deal with that crew as a unmarried merchandise.

  • Use Module Teams for similar header parts.
  • Use Rows or Columns as the principle flex bins.
  • Use Hole settings for spacing between direct flex pieces.
  • Steer clear of the use of padding as the principle spacing machine between modules.

Plan The Cell Conduct

The cellular header will have to no longer be a squeezed model of the desktop header. It will have to be a more practical format with fewer visual pieces. A excellent cellular development is an emblem on one aspect and a hamburger icon at the different. The entire navigation, CTA, and secondary hyperlinks can reside within a International Canvas.

  • Use Show Order when pieces want a other cellular collection.
  • Use Visibility settings to cover desktop-only modules on cellular.
  • Use a International Canvas when the similar cellular menu will have to seem sitewide.
  • Use Interactions to turn and conceal the cellular menu Canvas.

Take a look at The Main points Ahead of Publishing

Small header problems are simple to omit as a result of headers seem on each and every web page. Take a look at the format ahead of publishing the worldwide header.

  • Take a look at desktop, pill, and contact breakpoints.
  • Take a look at widths between the default breakpoints.
  • Verify dropdowns and Canvases take a seat above web page content material.
  • Set a transparent Z Index for overlays, sticky headers, and dropdowns.
  • Make sure that hamburger and shut icons have transparent labels.
  • Take a look at that menu hyperlinks, CTA hyperlinks, cart hyperlinks, and social hyperlinks paintings.

Development A Flexbox Header In Divi 5

Now, allow us to construct two headers from scratch. We will be able to recreate two layouts from our free 20 Header Design Pack: Design #11 and Design #12.

Divi 5 Flexbox header layout examples

Apply alongside step-by-step. You’ll additionally obtain the sources from this blog post to get a quicker get started.

Design #1: 3-Row Stacked Header

Some companies want greater than an emblem and navigation. Clinics, regulation places of work, companies, and native carrier suppliers ceaselessly want touch main points visual straight away. This format makes use of a navigation row and a software row. The software row holds touch knowledge and a CTA.

Atmosphere Up The Header In The Theme Builder

Pass to Divi > Theme Builder on your WordPress dashboard. Click on Upload International Header, then Construct International Header. The Visible Builder will open.

Open the phase settings ahead of including modules. Pass to Design > Format and set the Vertical Hole to 0px. This helps to keep the header rows flush in opposition to every different.

Setting a 0px vertical gap on a Divi 5 header section

Subsequent, move to Design > Spacing. Set the highest and backside padding to 0px. The outer phase remains compact, whilst every row can nonetheless regulate its personal spacing.

Adding zero top and bottom padding to a Divi 5 header section

Including The Header Rows

Get started with the default single-column row within the phase. This row will cling the nested rows. Open the row settings and move to Design > Format.

See also  Easy methods to Setup Cloudflare Unfastened CDN in WordPress (Step through Step)

Set Format Route to Column, Justify Content material to Get started, Align Pieces to Stretch, and Vertical Hole to 0px. This stacks the nested rows vertically and helps to keep them edge-to-edge.

Set the row’s most sensible and backside padding to 8px. Subsequent, reproduction the construction to create two stacked nested rows. The primary row will cling the emblem, navigation, and social icons. The second one row will cling touch main points and the CTA.

Duplicating a row structure in Divi 5

For the nested rows, set the Horizontal Hole to 2% and the Vertical Hole to 8px.

Setting horizontal and vertical gaps on a nested row in Divi 5

Follow the similar alignment good judgment to the column within the first row. This makes the modules more uncomplicated to align.

Growing The Two-Tone Background

Upload a gradient background to the phase. Set each colour stops to the similar level. This creates a pointy transition as a substitute of a combined gradient. Use 50% for a fair break up, or modify the forestall if one row is taller than the opposite.

Setting gradient colors and equal color stops for a Divi 5 header background

Development The Emblem, Navigation, And Social Row

The primary nested row has 3 portions: the emblem, navigation, and social icons. Flexbox controls how the ones portions take a seat in combination.

Including The Emblem And Navigation Workforce

Upload a Module Workforce for the emblem and navigation cluster. A gaggle turns out to be useful as a result of Flexbox distributes direct kids. When similar modules take a seat within a gaggle, the gang behaves as one flex merchandise.

Within the crew, set Format Route to Row, Horizontal Hole to 2%, Justify Content material to Get started, and Align Pieces to Heart.

Including The Dynamic Emblem

Upload an Symbol Module for the emblem. As an alternative of importing a static emblem, use the Web page Emblem dynamic tag. This connects the header emblem to Divi > Theme Choices > Basic, so long run emblem updates may also be treated from one position.

Applying the Site Logo dynamic tag to an Image Module in Divi 5

Including The Navigation Hyperlinks

Upload a Hyperlink Module within the similar crew. Taste the typography, spacing, and hues. Use Design Variables the place imaginable so the menu remains in keeping with the remainder of the website online.

Applying Design Variables to style a Link Module in Divi 5

Flip at the Loop Part toggle. Set the Question Kind to Menu, choose the WordPress menu you need to show, and set the loop order to apply the menu order.

Turning on the Loop Element toggle for a Link Module in Divi 5

Follow the Loop Menu Textual content dynamic tag to the Hyperlink Module label. Then follow the Loop Menu Hyperlink dynamic tag to the Hyperlink URL. The primary controls the visual label. The second one sends every merchandise to the right kind web page.

Applying the Loop Menu Text dynamic tag to a Link Module label in Divi 5

A Menu Module can construct a easy navigation bar quicker. Use a looped Hyperlink Module when you wish to have extra regulate.

Including Social Icons

Upload the Social Media Apply module to the row. Taste the icon measurement, spacing, and hues to check the header’s navigation taste.

Development The Touch Data And CTA Row

The second one row has one task. It puts touch main points at the left and a CTA at the proper. Set the row or column to Format Route: Row, Justify Content material: Area Between, and Align Pieces: Stretch. This helps to keep all sides aligned around the row.

Setting Space Between and Stretch alignment for the second header row in Divi 5

Development The Touch Main points Workforce

Position the touch main points within a Module Workforce. This issues as a result of Area Between works on direct kids. The touch crew turns into one merchandise at the left, and the button turns into the thing at the proper.

Within the crew, upload a Blurb Module for every touch merchandise. A Blurb works neatly as it comprises an icon, name, and frame content material. For the primary merchandise, use an envelope icon, set the name to Electronic mail, and upload the e-mail cope with because the frame content material.

Beneath Design > Symbol And Icon, set Icon Placement to Left. Beneath Sizing, set the icon measurement to 20px.

Adding an email Blurb module to a Divi 5 header

Reproduction the Blurb two times. Use the copies for the telephone quantity and trade hours, then change the icon, name, and frame content material for every merchandise.

Duplicating and editing contact Blurb modules inside a Divi 5 Module Group

Including The CTA Button

Upload the Button Module out of doors the touch main points crew. That placement is intentional. The touch crew sits at the left, and the button sits at the proper. With Area Between enabled, the CTA lands on the a long way fringe of the row.

Adding a CTA Button module to the second row of a Divi 5 header

Making The Format Responsive

The desktop header has extra content material than a cellular header will have to display. On smaller monitors, stay the emblem and hamburger visual, then transfer the overall menu right into a Canvas.

Hiding Desktop-Simplest Pieces

Cover the Hyperlink Module crew and Social Media Apply module on cellular. Use Complex > Visibility.

Hiding desktop navigation and social modules on the mobile breakpoint in Divi 5

Upload an Icon Module reverse the emblem. Set it to a hamburger icon, taste it to check the header, and conceal it on desktop.

Adding and styling a mobile hamburger icon in Divi 5

Cover the second one nested row on cellular too. The touch and CTA strip takes an excessive amount of house in a compact header.

Hiding the second header row on mobile in Divi 5

Adjusting The Cell Background

The gradient background now not is smart on cellular as it was once solely used to split two visual rows. On the cellular breakpoint, exchange the gradient with a flat background colour.

The light parts within the builder are hidden on the lively breakpoint. This is helping you ascertain what’s visual on cellular.

Setting a flat mobile background color for a Divi 5 header

Atmosphere Up The Cell Navigation Canvas

Create the cellular menu in a indifferent Canvas. Use the Canvas dropdown on the most sensible of the Visible Builder, then upload a brand new Canvas.

Opening the Canvas dropdown in Divi 5

Identify it obviously. Cell Menu works neatly. Make it international if the similar menu will have to seem around the website online. Set the Z Index to 999 so it seems that above the web page format.

Configuring Canvas options for a Divi 5 mobile menu

Positioning The Canvas

Within the Canvas, middle the content material. Set the column’s Justify Content material and Align Pieces to Heart. Within the Canvas phase, move to Complex > Place and set Place to Fastened.

See also  WordPress Security Guide for Busy Freelancers (2024)

Set Offset Foundation to Most sensible Left and set each offsets to 0. This we could the Canvas quilt the viewport as a substitute of sitting in commonplace web page waft.

Setting a Divi 5 Canvas section to fixed position

Pass to Design > Sizing and set the peak to 100vh. Use Flexbox alignment at the Canvas phase or column to middle the menu vertically and horizontally.

Including The Cell Menu Content material

Reproduction the desktop navigation Module Workforce into the Canvas to save lots of time. Set the gang’s Format Route to Column so the menu pieces stack vertically.

Set the Column Elegance to Fullwidth the place wanted. Take away any desktop-only visibility settings, then upload the CTA button beneath the menu.

Adding a menu loop and CTA button to a Divi 5 mobile Canvas

You’ll additionally upload telephone, hours, or e mail main points. Simplest come with them in the event that they lend a hand cellular guests act quicker. Stay the cellular menu centered.

Including The Shut Icon

Upload an Icon Module within the Canvas and set it to a detailed icon.

Adding a close icon to a Divi 5 mobile menu Canvas

After styling the shut icon, move to Complex > Place. Set Place to Fastened, Offset Foundation to Most sensible Proper, and each offsets to 20px. Set the Z Index to 999. This pins the shut icon to the nook of the viewport.

Positioning a close icon in the top-right corner of a Divi 5 mobile Canvas

When the Canvas is completed, move to the Canvas phase’s Complex tab. Disable it throughout all breakpoints beneath Visibility. This helps to keep it hidden on load till an Interplay displays it.

Wiring Up The Interactions

Make a selection the hamburger icon and upload an Interplay. Set the Cause Tournament to Click on, the Impact Motion to Display Part, and the Goal Module to the cellular menu Canvas phase.

Adding a click interaction to a hamburger icon in Divi 5

Make a selection the shut icon within the Canvas and upload the opposite Interplay. Set the Cause Tournament to Click on, the Impact Motion to Cover Part, and use the similar Canvas phase as the objective.

Adding a click interaction to a close icon in a Divi 5 Canvas

Non-compulsory Accessibility Cleanup

Give the hamburger and shut icons transparent labels. This is helping guests the use of assistive era. In case your construct makes use of Divi 5’s semantic part choices, set the navigation wrapper to nav.

Previewing The Completed Header

This is all it takes to construct a sophisticated responsive header in Divi 5.

The result’s maintainable. The navigation comes from WordPress, the emblem comes from the Web page Emblem dynamic tag, the cellular menu lives in a Canvas, and the open and shut habits lives in Interactions. The spacing and alignment come from Flexbox, so no hidden reproduction sections are wanted.

Design #2: Unmarried-Row Navigation Header

No longer each and every website online wishes a software bar. Some websites want a blank header that remains out of the best way. This format works neatly for SaaS merchandise, portfolios, club websites, and light-weight trade websites.

The construction is unassuming. The brand and navigation take a seat at the left, and supporting movements take a seat at the proper.

Including A Two-Column Flexbox Row

The row makes use of a two-column format. The broader left column holds the emblem and navigation. The narrower proper column holds supporting parts, equivalent to seek, cart, social icons, or a CTA.

Using an offset column template for a single-row Divi 5 header

For the row, set the Horizontal Hole to 2% and the Vertical Hole to 8px. Set Justify Content material to Get started and Align Pieces to Stretch. Stretch helps to keep each columns the similar top, even if their contents fluctuate.

Development The Left Column

Set the primary column to Format Route: Row, Justify Content material: Get started, and Align Pieces: Heart. Upload the emblem and navigation the use of the similar setup from Design #1.

Upload an Symbol Module hooked up to the Web page Emblem dynamic tag. Then upload a Hyperlink Module the use of Menu Looping.

Building the logo and menu in the first column of a Divi 5 header

Development The Proper Column

Set the second one column to Format Route: Row and Align Pieces: Heart. Use an 8px horizontal and vertical hole to stay the supporting movements calmly spaced.

Upload Icon Modules for seek and cart if the website online wishes them. Hyperlink the cart icon to the cart web page for WooCommerce websites, and take away it for non-commerce builds. Then upload the Social Media Apply module and Button Module aspect by means of aspect.

Adding icons, social links, and a CTA to the second column of a Divi 5 header
Adapt Your Design To Smaller Breakpoints

Very similar to the primary header, create a canvas with the entire parts you need on your cellular menu: navigation, CTA buttons, and extra. Likewise, upload a detailed button. Then a hamburger icon subsequent on your website online emblem whilst hiding the entirety else. After which post interactions to glue a majority of these items in combination.

The Probabilities Are Just about Never-ending With Divi 5

The 2 headers glance other, however the means is similar. Flexbox handles the format. Hyperlink Modules and Menu Loops care for dynamic navigation. Canvases stay cellular overlays break away the principle header. Interactions care for the open and shut habits.

Each and every device does its section. As a result of they’re constructed into Divi 5, the workflow remains visible and maintainable. You aren’t sewing the header along with reproduction sections, CSS fixes, or hidden JavaScript snippets.

Divi 5 is to be had now. This type of header workflow is the place its format and interplay enhancements shine.

The put up How To Build A Flexbox Header In Divi 5 seemed first on Elegant Themes Blog.

WordPress Maintenance Plans | WordPress Hosting

read more

0 Comments

Submit a Comment

DON'T LET YOUR WEBSITE GET DESTROYED BY HACKERS!

Get your FREE copy of our Cyber Security for WordPress® whitepaper.

You'll also get exclusive access to discounts that are only found at the bottom of our WP CyberSec whitepaper.

You have Successfully Subscribed!