1. PROMO Subscribe our All Access Pass @ 75% OFF & access all our 16+ premium Divi extensions: Divi Block Pro, Carousel Toolkit, etc.LEARN MORE
Dismiss Notice
NEW Divi.Help Pro Carousel AI Toolkit - Magically turn your Divi design into carousel, simply by using our online toolkit. No plugins needed. Now it works with Divi 5 as well!Try our carousel AI toolkit
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. Now it works with Divi 5 as well!
Learn More About Divi BlockFree Version ~ 340+ Free Blocks

Divi Media Breakpoints Not Reflecting on Page Load

Discussion in 'Free Divi Community Forum' started by alan1090, Apr 30, 2024.

  1. alan1090

    alan1090 New Member

    I changed the divi media breakpoints by modifying the stylesheet and relatives CSS files into the theme editor (I just want to keep 3 breakpoints: 1) Up to 576px, 2) From 576px to 980px, 3) From 980px).

    The problem is that when I load pages on my website it appears that certain elements (like .et_pb_text_0 h1) keep the media query max 767px (as shown in screenshot).

    I don't find from where the page load CSS data in order to render the page. Because all media queries with 767px has been deleted from every CSS files

    I already tried by enabling/disabling the Static CSS File Generation, in Divi Theme Options > Builder > Advanced. But the media query doesnt change
     

    Attached Files:

    1. PRO MEMBER PERKS Divi Ultimate Archive Plugin - Tons of elegant premade sidebar styles to choose from for your Divi site:Learn More
  2. alan1090

    alan1090 New Member

  3. Divi Booster

    Divi Booster Divi Expert

    Hey Alan,

    Divi generates a lot of its CSS (e.g. module-specific CSS) dynamically. Some of this is written to cached CSS files under wp-content/et-cache/ - but note that these are sometimes regenerated. And some is added inline into the page so will never appear in CSS files at all.

    Divi's breakpoints are used extensively and in many cases hard-coded in the theme itself, which would make entirely removing a breakpoint a potentially difficult job.

    Something you might want to look at though, is the following code in Divi:

    Code:
    Log In or Sign Up to view this code.
    It is used by quite a few places to generate the media queries that end up in the final CSS. And since there is a filter "et_builder_media_queries", you could modify the media queries it returns. I haven't tested it myself, but it looks like you'd need to leave the keys as they are, but could replace the media queries (e.g. by changing 767px / 768px values to something more suitable).

    If you're not familiar with WP filters / PHP code, let me know and I'll try to create an example.

    I don't think this will eradicate all usage of the breakpoint (not all of Divi's media query generation comes through this code), but it might help a bit.
     
    1. PRO MEMBER PERKS Divi Block Pro - Premade before / after image slider for your Divi site without using any plugins:View Demo
  4. alan1090

    alan1090 New Member

    ok, thank you for the reply!

    Can you just specify which theme file are you referring to?

    Then I can try to make the changes
     
  5. Divi Booster

    Divi Booster Divi Expert

    The code is in wp-content\themes\Divi\includes\builder\class-et-builder-element.php at line 19642, but I wouldn't modify the file directly, as your changes will be overwritten as soon as Divi updates.

    Rather, the existence of the "apply_filters" in the code means we can write some PHP code that can change the media queries that Divi function returns, and can place that PHP code somewhere where it won't be affected by Divi updates, such as in the functions.php file of a child theme, or in a plugin like Code Snippets.

    Here's an example of the PHP code to do this:

    Code:
    Log In or Sign Up to view this code.
    It modifies the media queries references to 767/768px down to 576/577px, and modifies the reference to 479px up to 576px. Most likely you'll need to modify things some more to meet your needs, but hopefully that gives you a start.
     
    1. PRO MEMBER PERKS Divi Block Pro - Premade rolling text design for your Divi site without using any plugins:View Demo
  6. alan1090

    alan1090 New Member

    Super! It seems that was exactly what I needed!

    Thank you very much!
     
  7. Divi Booster

    Divi Booster Divi Expert

    Happy to help, Alan!
     
    1. PRO MEMBER PERKS Divi.Help Pro Layout Packs - Agency Divi layout pack featuring modern overlay archive blog layout with hover effects:View Demo