1. HOT Upgrade to Pro Membership @ $99 / Lifetime & access all our 16+ premium Divi extensions: Divi Block, Carousel Toolkit, etc.LEARN MORE
Dismiss Notice
HOT Divi Login Customizer Plugin - White-label your Wordpress login page for your Divi site.
View premade login page design
BEST Divi Block - A revolutionary drag & drop tool to easily mix & match 960+ premade blocks (Light & Dark) to kick start your Divi site design. Special module designs are included as well. Also newly added AI generator & color.
Learn More About Divi BlockFree Version ~ 340+ Free Blocks

Change header media breakpoints

Discussion in 'Free Divi Community Forum' started by AWS, Dec 3, 2024.

  1. AWS

    AWS New Member

    Wondering if someone can help me - I just can't figure out the CSS code I need for this.

    Website is https://testing.agneswaterseafood.com.au.

    I've created a global header with two sections, one which I want visible for wider screens and the other which I want visible for smaller screens.

    Specifically, Section 1 is intended for 1151px width and greater (i.e. desktop view up until the point that the menu text no longer fits into a single line.

    And, Section 2 is intended for 1150px width and less (i.e. mobile and tablet views plus some).

    I know that I can just make visibility settings but I need to customise the break points just for the global header.

    Any help would be appreciated.
     
    1. PRO MEMBER PERKS Custom Color Scheme + Premade Layouts - A perfect combination to boost productivity:Try Now
  2. AWS

    AWS New Member

    Correction, given I've made some changes - it should be 1191px width and greater for Section 1. And 1190px and less for Section 2.
     
  3. Divi Booster

    Divi Booster Divi Expert

    Hey AWS,

    You should be able to do it with CSS media queries.

    Add the following code to your site (e.g. at "WP Admin > Divi > Theme Options > General > Custom CSS"):

    Code:
    Log In or Sign Up to view this code.
    Then assign the class "section-1" to your wide section at "Section Settings > Advanced > CSS ID & Classes > CSS Class", and likewise assign the class "section-2" to the narrow section.

    Hope that helps!
     
    1. PRO MEMBER PERKS Divi Ultimate Header Plugin - Custom Divi Builder header on desktop + default slide in / fullscreen menu on mobile:Learn More
  4. AWS

    AWS New Member

    You're amazing! Thank you! That makes the headers behave how I want.

    I'm just struggling with one issue. Mobile, tablet and desktop views are fine but there's some weirdness in that intermediary space between 981px and 1174px (which is what I finally decided on as a new break point).

    There's a gap up the top and the header doesn't stick to top. I've looked through so many of the settings and I can't quite understand why it's doing that. The same header works fine on mobile and tablet views and sticks to top for those.
     
  5. Divi Booster

    Divi Booster Divi Expert

    You're welcome, AWS!

    It looks like the issue between those breakpoints is due to a "top" value set on one of the sections and a height set on the header (presumably for the benefit of the other breakpoints) which is larger than its content. The following CSS should sort them out:

    Code:
    Log In or Sign Up to view this code.
    Good luck and let us know if you need any further help with it.

    Thanks!
     
    1. PRO MEMBER PERKS Divi Mini Cart Pro Plugin - Instantly add 3 different types of mini cart to your Divi site:Learn More