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

Solved CSS adjustment to Toggle title

Discussion in 'Free Divi Community Forum' started by carolineanne11, Mar 19, 2025.

  1. carolineanne11

    carolineanne11 New Member

    I am using the following code to set the pink colour on the title

    .et_pb_toggle_title {
    margin-left: -20px;
    margin-right: -20px;
    margin-top: -20px;
    margin-bottom: -20px;
    padding: 20px!important;
    background: #fdeaf0;
    }
    .et_pb_toggle_title:before {
    right: 10px!important;
    }

    What I want to do is have this code be conditional and only affect toggle titles that are active, so the pink toggle title background will only appear on a toggle that is open. I don't know how to do that and would really appreciate some help.

    Screen Shot 2025-03-20 at 00.05.08.png


    Also for anyone who finds this post and wants to copy and paste the top code / do something similar, adding in the CSS:

    .et_pb_toggle_content.clearfix p {padding-top: 20px;}

    should fix the paragraph to title spacing issue :)

    - but full disclosure I'm new to this (currently making my first ever wordpress website!) and I've just been doing trial and error with web inspector tools to make adjustments, so I apologise if all the CSS in this post is a technical mess - it seems to work, but I welcome comments and corrections!
     
    1. PRO MEMBER PERKS Divi Block Pro - Premade floating button design for your Divi site without using any plugins:View Demo
  2. Divi.Help

    Divi.Help Administrator
    Staff Member

    To target the active one, you can amend .et_pb_toggle_title into .et_pb_toggle_open .et_pb_toggle_title

    It's better to put it in the Toggle module settings > Advanced > Custom CSS > Free-Form CSS, so that it only affect the selected toggle module. If you use your CSS, it will affect all toggles on your site.

    But to use the Free-Form CSS, you will need to append the CSS with selector. For example:
    Code:
    Log In or Sign Up to view this code.
     
  3. carolineanne11

    carolineanne11 New Member

    Thank you so much! Is there a way to animate the transition to ease it in some way (so the colour change isn't abrupt when active)?
     
    1. PRO MEMBER PERKS Beautifully crafted custom colored 'Freelancer' Divi layout for all Pro members:View Demo
  4. carolineanne11

    carolineanne11 New Member

    Just adding an update for those who may come across this post later:

    I used the following code to turn the background of my toggle the same colour as my custom title on hover, this sidesteps the issue of an abrupt colour change.

    .et_pb_module.et_pb_toggle_close:hover .et_pb_toggle_title {
    margin-left: -20px;
    margin-right: -20px;
    margin-top: -20px;
    margin-bottom: -20px;
    padding: 20px!important;
    background: #fdeaf0;
    }
    .et_pb_module.et_pb_toggle_close:hover .et_pb_toggle_title:before {
    right: 30px!important;
    }

    please use the selector tag as mentioned above if you only want to affect a particular toggle.

    I only have one toggle on my website so here is a copy of all the code in my custom css box:

    .et_pb_toggle_open .et_pb_toggle_title {
    margin-left: -20px;
    margin-right: -20px;
    margin-top: -20px;
    margin-bottom: -20px;
    padding: 20px!important;
    background: #fdeaf0;
    }

    .et_pb_toggle_title:before {
    right: 10px!important;
    }

    .et_pb_toggle_open .et_pb_toggle_title:before {
    right: 30px!important;
    }

    .et_pb_module.et_pb_toggle_close:hover .et_pb_toggle_title {
    margin-left: -20px;
    margin-right: -20px;
    margin-top: -20px;
    margin-bottom: -20px;
    padding: 20px!important;
    background: #fdeaf0;
    }

    .et_pb_module.et_pb_toggle_close:hover .et_pb_toggle_title:before {
    right: 30px!important;
    }

    .et_pb_toggle_content.clearfix p {padding-top: 20px;
    }
     
  5. Ashley Durant

    Ashley Durant New Member

    Just wanted to add a thanks for this! Has helped me massively!
     
    1. PRO MEMBER PERKS Divi Ultimate Archive Plugin - Replace the default archive "Older Entries" with beautiful pagination:Learn More