Deprecated: Creation of dynamic property SureCart\Licensing\Updater::$cache_key is deprecated in /home/292293.cloudwaysapps.com/ejxumdpjev/public_html/wp-content/plugins/pac-wp-inbox/inc/licensing-sdk/Updater.php on line 22

Deprecated: Creation of dynamic property SureCart\Licensing\Updater::$cache_key is deprecated in /home/292293.cloudwaysapps.com/ejxumdpjev/public_html/wp-content/plugins/pac-wp-inbox/inc/licensing-sdk/Updater.php on line 22

Deprecated: Creation of dynamic property SureCart\Licensing\Updater::$cache_key is deprecated in /home/292293.cloudwaysapps.com/ejxumdpjev/public_html/wp-content/plugins/pac-wp-inbox/inc/licensing-sdk/Updater.php on line 22

Deprecated: Creation of dynamic property SureCart\Licensing\Updater::$cache_key is deprecated in /home/292293.cloudwaysapps.com/ejxumdpjev/public_html/wp-content/plugins/pac-wp-inbox/inc/licensing-sdk/Updater.php on line 22

Deprecated: Creation of dynamic property SureCart\Licensing\Updater::$cache_key is deprecated in /home/292293.cloudwaysapps.com/ejxumdpjev/public_html/wp-content/plugins/pac-wp-inbox/inc/licensing-sdk/Updater.php on line 22

Deprecated: Creation of dynamic property SureCart\Licensing\Updater::$cache_key is deprecated in /home/292293.cloudwaysapps.com/ejxumdpjev/public_html/wp-content/plugins/pac-wp-inbox/inc/licensing-sdk/Updater.php on line 22

Deprecated: Creation of dynamic property SureCart\Licensing\Updater::$cache_key is deprecated in /home/292293.cloudwaysapps.com/ejxumdpjev/public_html/wp-content/plugins/pac-wp-inbox/inc/licensing-sdk/Updater.php on line 22

Deprecated: Creation of dynamic property WOO_SL_functions::$query_vars is deprecated in /home/292293.cloudwaysapps.com/ejxumdpjev/public_html/wp-content/plugins/woocommerce-software-license/include/class.sl.functions.php on line 35

Deprecated: Creation of dynamic property WOO_SL::$licence is deprecated in /home/292293.cloudwaysapps.com/ejxumdpjev/public_html/wp-content/plugins/woocommerce-software-license/include/class.sl.php on line 21

Deprecated: Creation of dynamic property WOO_SL_functions::$query_vars is deprecated in /home/292293.cloudwaysapps.com/ejxumdpjev/public_html/wp-content/plugins/woocommerce-software-license/include/class.sl.functions.php on line 35

Deprecated: Return type of GeoIp2\Model\AbstractModel::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/292293.cloudwaysapps.com/ejxumdpjev/public_html/wp-content/plugins/termageddon-usercentrics/vendor/geoip2/geoip2/src/Model/AbstractModel.php on line 63

Deprecated: Return type of GeoIp2\Record\AbstractRecord::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/292293.cloudwaysapps.com/ejxumdpjev/public_html/wp-content/plugins/termageddon-usercentrics/vendor/geoip2/geoip2/src/Record/AbstractRecord.php on line 57

Deprecated: Automatic conversion of false to array is deprecated in /home/292293.cloudwaysapps.com/ejxumdpjev/public_html/wp-content/plugins/divi-social-sharing-buttons/includes/modules/SharingButton/SharingButton.php on line 115

Deprecated: Creation of dynamic property DMB_Module_Code_Snippet::$icon is deprecated in /home/292293.cloudwaysapps.com/ejxumdpjev/public_html/wp-content/themes/Divi/includes/builder/class-et-builder-element.php on line 1403

Deprecated: Creation of dynamic property DMB_Module_Code_Snippet::$whitelisted_fields is deprecated in /home/292293.cloudwaysapps.com/ejxumdpjev/public_html/wp-content/themes/Divi/includes/builder/class-et-builder-element.php on line 1403

Deprecated: Creation of dynamic property DMB_Module_Code_Snippet::$fields_defaults is deprecated in /home/292293.cloudwaysapps.com/ejxumdpjev/public_html/wp-content/themes/Divi/includes/builder/class-et-builder-element.php on line 1403
How To Change The Divi Menu Module Hamburger Icon To An X When Open - Pee-Aye Creative

Deprecated: Creation of dynamic property ET_Builder_Module_Comments::$et_pb_unique_comments_module_class is deprecated in /home/292293.cloudwaysapps.com/ejxumdpjev/public_html/wp-content/themes/Divi/includes/builder/class-et-builder-element.php on line 1403
î‚£

Subscribe On YouTube

Join other subscribers and enjoy other Divi video tutorials!

How To Change The Divi Menu Module Hamburger Icon To An X When Open

Nelson Miller Profile Orange
This quick CSS code snippet and tutorial will change the Divi Menu Module hamburger icon into an X when the mobile menu is open.

Deprecated: Use of "parent" in callables is deprecated in /home/292293.cloudwaysapps.com/ejxumdpjev/public_html/wp-content/plugins/divi-module-code-snippet/divi-shim/class_DBCS_Builder_Module_3_1.php on line 165

Deprecated: Use of "parent" in callables is deprecated in /home/292293.cloudwaysapps.com/ejxumdpjev/public_html/wp-content/plugins/divi-module-code-snippet/divi-shim/class_DBCS_Builder_Module_3_1.php on line 158

Deprecated: Use of "parent" in callables is deprecated in /home/292293.cloudwaysapps.com/ejxumdpjev/public_html/wp-content/plugins/divi-module-code-snippet/divi-shim/class_DBCS_Builder_Module_3_1.php on line 165

Deprecated: Use of "parent" in callables is deprecated in /home/292293.cloudwaysapps.com/ejxumdpjev/public_html/wp-content/plugins/divi-module-code-snippet/divi-shim/class_DBCS_Builder_Module_3_1.php on line 158

Changing The Divi Menu Module  Icon To An X

This is going to be a short tutorial, but we all love quick and easy, right? Changing the Divi Menu Module hamburger icon into an X is a simple process. By default, the icon is part of a built-in icon font called ETmodules that comes with Divi. The default icon code for the hamburger menu is 61, and we are changing that to the X when the menu is opened, which has an icon code of 4d. So once you press the hamburger menu icon to open the menu, the icon gets replaced and it provides a better user experience.

Where To Paste The CSS Code

1. Divi Assistant
If you are using our Divi Assistant plugin, simply paste the code in the CSS tab in the custom code window in the Divi Visual Builder.

2. Child Theme
If you are using a child theme, paste this code into the style.css file. If you don't have a child theme, you can generate a child theme directly on your site or download our free child theme.

3. Divi Theme Options Integration
Otherwise, paste this code in your Divi>Theme Options>Custom CSS code box.

If you need help understanding where to paste the code, please check out our complete guide about where to add custom code In Divi.

/*change Divi hamburger menu to X*/
.mobile_nav.opened .mobile_menu_bar:before {
    content: '\4d';
}

That was about as easy as they come! Just one tiny snippet and the Divi Menu Module now has an X as the open icon!

Closed

Open

EDIT: In the comments, Shawn asked about how to animate this. Unfortunately it’s not possible to “animate” the icons by morphing their sizes, as these are solid icons, not vectors. So one trick that Jimmy suggests is to add a nice rotation effect. Here is the code, it looks pretty nice!

/*rotate the Divi Menu icon on click*/

.mobile_menu_bar:before {
	transition: all .4s ease;
	transform: rotate(0deg);
	display: block;
}


/*rotate the Divi Menu icon on click*/

.mobile_nav.opened .mobile_menu_bar::before {
	transition: all .4s ease;
	transform: rotate(90deg);
	display: block;
}

Subscribe For More Things Like This!

At the start of each month, we send out a recap newsletter from the month before with family news, Divi news, our latest tutorials, and product news. Occasionally, if the news is too exciting to wait, we will send out another email separate from the monthly newsletter. That’s what you get when you subscribe, and of course you can unsubscribe if you are no longer interested!

Blog Post Optin
Divi Logo (2)

Shop Our Divi Products

Plugins • Courses • Templates

Visit The Shop

Featured Products

î‚£

Divi Tutorials On YouTube

Our videos have views! Join subscribers and enjoy over video tutorials!

Visit Our Channel

Leave A Response!

By commenting you agree to our Blog & YouTube Comments Policy

62 Comments

  1. Tim

    This is great, is there a similarly simpler way to adjust the time it switches to an X?
    Your tutorials are excellent!

    Reply
  2. mara

    Hello Nelson! Thank you for the tutorial. I have some issue trying to change the color of the hamburger icon and the X. The default color is blue and I’m trying to make it black. Can you help me? Thank you in advance and for all the great content !

    Reply
  3. Bryan

    Is there an easy way to add a transition to both?

    Reply
  4. Entr

    Hi, Thank you so much for this tutorial and all the others.
    Is there a way to do this with a button ?
    I am not using the divi menu but the divi module Button.
    I pasted the hamburger icon in the text of the button and I want it to change to an x when it is open.

    Thanks a lot for your help !

    Reply
  5. Luca

    Hi! Congratulations on your tutorials, really great!
    I have a problem with the “X” code that doesn’t match ‘4d’

    They have been updated?

    Reply
    • Milan
      \4d
      

      worked for me 😉

      Reply
      • beatriz

        Thanks, I had the same problem on some devices and that worked

  6. Sean Craig <span class="comment-author-role-label"><a href="https://www.peeayecreative.com/product/divi-adventure-club/" class="comment-author-role-link" rel="external nofollow" target="_blank">Divi Adventure Club Member</a></span>

    Thanks for this!
    Just a quick note. Your snippet needed a \ for me to make it work. Thought I’d share you so you can update your blog.

    Reply
  7. Mike Nelson

    I posted this question on the YouTube comments area of the same tutorial. So I apologize in advance. So here it is.

    I’m trying to change the default square hamburger (61) to a round (63).
    Short and sweet!

    Reply
  8. Senan

    Hello Nelson, thanks for the tutorial!
    Is there anyway to animate the hamburger toggle icon?
    Something like this plugin but for the menu module instead of the standard header menu.

    Thanks

    Reply
  9. Fernando Cabrera

    Hi Nelson! Thanks for the tutorial! Everything works fine. However I do have a problem with this. I have two menu modules in the same page, and when I add the css code, it changes the two hamburger icons, when instead I only want to modify one. Do you know how can I achieve it?

    Reply
      • Jemma Pollari <span class="comment-author-role-label"><a href="https://www.peeayecreative.com/product/divi-adventure-club/" class="comment-author-role-link" rel="external nofollow" target="_blank">Divi Adventure Club Member</a></span>

        Hi Nelson, I am trying to do this (changing the icon of one menu while leaving the other as a hamburger).

        I’ve added the class
        top_bar_menu

        to the menu module I want to change, and the code:

        .top_bar_menu:before {
        content: ‘\e08a’;
        }

        into Divi > Theme Options > Custon CSS

        but it doesn’t work. Am I using the custom class in the right way?

  10. shawn

    hi, how can put animated effect for the icon when change to multiply icon

    Reply
    • Jimmy Lemon

      Shawn, try this CSS.

      /* Animate divi mobile icon on click / switch out */

      .et_pb_menu_0_tb_header .mobile_nav .mobile_menu_bar:before {
        transition: all .4s ease;
        transform: rotate(0deg);
        display: block;
      }

      #et_mobile_nav_menu .mobile_nav.opened .mobile_menu_bar::before, .et_pb_module.et_pb_menu .et_mobile_nav_menu .mobile_nav.opened .mobile_menu_bar::before {
        transition: all .4s ease;
        transform: rotate(90deg);
        display: block;
      }

      Reply
      • Oliver Gehrmann

        This is all the code you need (there’s 2 display: block; statements, one of which is not necessary; there’s also 2 transition statements, one of which is not necessary, etc.):

        .mobile_menu_bar::before {
        display: block;
        transition: all .4s ease;
        }
        .mobile_nav.opened .mobile_menu_bar::before {
        content: “M”;
        transform: rotate(90deg);
        }

        But thanks for this great suggestion Jimmy, it works like a charm!

  11. Dave Hinxman

    Hi Nelson, I’m using the fullscreen hamburger option which, when clicked, overlays the screen with a black layer and has the close cross in the top right corner. I cannot get the hamburger to rotate and become the cross when open. Any ideas how that can be done with this menu? Also, the cross is annoyingly in a different position to the hamburger icon?

    Reply
    • Hemant Gaba

      Could you please share the URL of the website where the Menu is placed for us to investigate further?

      Reply
  12. Anna

    Hi! For me “4” was not working to display the X icon. I had to use “\4d”

    Thanks!!!
    Anna

    Reply
  13. Louise

    Always great tutorials for the Divi theme, thank you!
    Just one thing, in the code for changing the hamburger menu to the X icon, it states to use “content: ‘d’;”, but that just adds dots before the hamburger icon. As you show in the video, it should be: “content: ‘\4d’; ”
    Cheers!

    Reply
    • Hemant Gaba

      Hey Louise,

      We appreciate your feedback but in the guide it is stated as \4d for the cross sign so is there anything we are missing out here?

      Reply
  14. John Tanedo

    Great tutorial but I think you have to put in “\4d” for the content on .mobile_nav.opened .mobile_menu_bar:before instead of just “d” to show the X

    Reply
  15. Nasroo Ajani

    Dear Nelson,

    Great help and tutorials you have there, just awful! Thanks.

    Is it possible to close the open Hamburger menu, if a user scroll on the page itself. In my case, they have to close the menu by touching the X.

    Thanks for your help

    Reply
    • Hemant Gaba

      Hey Nasroo,

      I have checked the website and I am not able to replicate the issue on my end.

      Reply
  16. Maddy Seeley

    Hi there,

    I’m having an issue where the X icon is in a slightly different location (further towards the right) then the hamburger icon, when the menu is opened. I can’t seem to find anything in the CSS that would be causing this? Happy to supply a link if that helps.

    Any help would be appreciated.

    Reply
    • Hemant Gaba

      Hey Maddy,

      Could you please share the URL of the website for me to investigate it further?

      Reply
      • Pavol

        I have same the same issue. Any solution? It is also combined with mobile full screen menu css.

      • Hemant Gaba

        Hey Maddy,

        Please find the code given below and remove it. Your problem will be solved.

        .pa-fullscreen-menu .opened .mobile_menu_bar {
        position: fixed!important;
        }

        Let me know how it goes.

      • Maddy Seeley

        Thank you so much for that! Worked perfectly.

  17. Ola

    Hello 🙂
    how can I chnge the size of hamburger icon ? Thanks!

    Reply
  18. Julian

    Hi Nelson,
    Thank you for your great tutorials. You have helped me a lot on many websites.
    I have a small problem with the display:
    I’m currently working on a website with several subpages. I changed the hamburger icon to X. On some subpages, the X is displayed correctly when the menu is open. On other subpages not only the X but also the old symbol is displayed. Thus, both symbols are superimposed.
    Do you have any idea?
    Thank you and best regards
    Julian

    Reply
  19. Thom

    I’m looking for a way to enlarge the hamburger icon (and subsequently also the X). How does it work?
    Greetings Thom

    Reply
  20. Mikala

    When adding the full code
    #et_mobile_nav_menu .mobile_nav.opened .mobile_menu_bar::before,
    .et_pb_module.et_pb_menu .et_mobile_nav_menu .mobile_nav.opened .mobile_menu_bar::before {
    content: ‘\4b’;
    }
    The 3 line of the hamburger menu becomes only one horizontal line. And on some subpages it turns into the letter K.

    Reply
    • Hemant Gaba

      Hi Mikala!

      The icon code is no correct in the code you shared. Please use the following code and see if it helps:

      #et_mobile_nav_menu .mobile_nav.opened .mobile_menu_bar::before,
      .et_pb_module.et_pb_menu .et_mobile_nav_menu .mobile_nav.opened .mobile_menu_bar::before {
      content: ‘\4d’;
      }

      Reply
  21. Levi

    Hi. I tried the following code you offered but even though the burger icon rotates, it turns just into a rotated burger to the right. There’s no x.

    Here’s my url: https://amrelektro.ro/magazin

    I can’t seem to make it work.

    Reply
  22. Mikala

    Is there a way to change the x icon to a different color than the hamburger icon?

    Reply
    • Hemant Gaba

      Hi Mikala!

      Please add the following code instead of the above one:

      .mobile_nav.opened .mobile_menu_bar:before {
      content: ‘\4d’;
      color: red;
      }

      Change the color in the code as per your requirement.

      Reply
      • Mikala

        Thank you for this, works like a charm 😉

        Can the same be done for the logo?
        A different file with a different color than before opening the menu? Or is it some JS that is necessary?

        As always, great tutorials. Thank you 😀

Submit a Comment

Your email address will not be published. Required fields are marked *

Recent Posts

0

Your Cart