How to Create Anchor Links in Divi – Step by Step

Victor Duse

Oct 16, 2023

Comments

Editorial Note: I may earn a commission when you visit links on this website.

It’s really easy to create anchor links in Divi. The anchor link lets your visitors jump to different sections on the same page without leaving it. It’s extra useful in long Divi pages and posts.

HTML.COM defines anchor links in a comprehensive way:

The anchor element is used to create hyperlinks between a source anchor and a destination anchor. The source is the text, image, or button that links to another resource and the destination is the resource that the source anchor links to.

Join +4 730 subscribers!

Two Examples of Anchor Links in Divi

As you can see in the video above, anchor links can be used both in navigation menus and in buttons on a page or in a post.

You can also use the Divi Text module or the default WordPress editors (Gutenberg Block Builder and the Classic Editor) to add anchor links in plain text.

When is it Appropriate to Use Anchor Links?

Anchor links are best used in long and dense pages and posts. They are also a good choice for one page websites. A good Table of Contents section is often based on anchor links as well as nifty Back to Top buttons.

Step 1: Create your anchor destination in Divi

The first step is to “drop your anchor” in the location where you want your visitors to arrive. To do this, you need to add a unique ID (identifier) to a section, row or module. In the next step, we will create links that target this ID.

  1. Enable the Divi Visual Builder on the page where you want to add the anchor.
  2. Click the cogwheel to edit the element (a section, row or module) where you want to add the anchor.
  3. Go to the Advanced tab and open the  CSS ID & Classes tab.
  4. Add a clear name for your anchor (for example blog or contact-us) in the CSS ID field.
    ⚠️ Don’t use spaces or special characters like # in your CSS ID.
  5. Click the green button to save the settings and then save the page.
Add a CSS ID anchor in Divi
Now you have dropped your anchor and created the destination for your anchor links.

Step 2: Create your Anchor Links in Divi

Now it’s time to add the links that will send your visitors to your fresh anchor destination. The principle is simple: Just add a link to your CSS ID with a hash (#) in front of it, for example #blog or #contact-us. You can of course link to an anchor on a specific page on your Divi website by adding the slug first, for example /about-us/#contact-us. You can even deep link to an anchor on your website from an external source like an email or social media by adding your full URL followed by the #css-id, for example https://mysite.com/about-us/#contact-us.

Here are the most common use cases.

That’s all for today!

I hope that you enjoyed this post. Subscribe to VictorDuse.com on YouTube and join our Facebook group for more crisp content on WordPress and web design.

👉 Related post: How to Create Custom Sticky Back to Top Designs with Divi (from Elegant Themes)

👉 Free course: Create a website from scratch with Divi

Victor Duse

By Victor Duse

Victor is a Swedish WordPress expert with +20 years experience of web development and marketing communications. Time away from keyboard is spent together with family and on Brazilian Jiu-Jitsu mats.

About Victor » 

Related posts

18 Comments

  1. Hello Victor, once agin a very helpful, clear and well written tutorial on the essential basics of Divi and WordPress. Thanks for the troubleshooting section at the end, and the common mistakes we make when setting up anchor links. Your input is greatly appreciated, and bookmarked. Much appreciated.

    Reply
  2. Thank you for the kinds words, Rob! 🙂

    Reply
  3. Hey there!! Do you know how to adjust the position of where the anchor link jumps to? I need it to jump down about 300 px for my static menus.

    Reply
    • There’s no string to add extra pixels to an anchor link (well maybe with some advanced JS, but that’s above my paygrade :-)). But you can try add an invisible divider with a top margin of 300 px and CSS ID. Or you can add an inline CSS ID to a text in a text module (or any other element that can process HTML) and add a CSS ID to a word, a letter or the whole text, like this:

      You can add some text here.

      Or you can add an “invisible space” with a CSS ID:

       

      Reply
  4. When I use anchor links, I find that Divi reloads my page again after everything has loaded. It’s a terrible user experience. Is there any workaround for that?

    Reply
    • Does the reload happen in frontend or backend? Some third party plugins makes the Divi Builder reload when editing a page.

      Reply
  5. Hi,
    When I add a link from a menu button to an anchor on the home page – it highlights both pages in the menu. Is there a way to only highlight the anchor link when its on that area?

    I have a menu – HOME – ABOUT US – CONTACT US.
    I have an section on the Home page – called About Us and I have an anchor point at that section.
    If I am on a Page – it highlights that page in the menu to show the page I’m on. But as both HOME and ABOUT US are on the same page – both are highlighted. Is there a way to change this so that the ABOU US is only highlighted when I click that button?

    Thanks in advance

    Reply
    • Hi Eoin! I see what you are looking for here but it would be pretty complex so I don’t have a solution up my sleeve.

      Reply
  6. I have added anchor links with Divi, however they are flagging as an accessibility issue when I run an accessibility checker. Is there any way to make anchor links accessible?

    Reply
  7. Is this the ideal way to do it if I have 1000s of anchors across 100s of articles?

    Basically, we are doing news, each day has 1 post with multiple headlines. I will be making an anchor to each headline.

    I don’t mind the manual labour of adding it every time, I just want to make sure there is not going to be a CSS file somewhere that gets bloated with tens of thousands of references.

    Reply
  8. Hi, Thanks for the great writeup! I have two issues with my menu:

    1. I’ve tried to follow these instructions exactly (including the 3 troubleshooting tips), and my menu links still aren’t working properly. The CSS ID is a simple name (eg. “gallery” (without the quotes)), and the menu link is the page URL followed by “/#gallery”. Clicking the menu item takes me to the correct page, but not down to the position of “gallery.” It just stays at the top. All 15 or so sub-menus have this same issue across 3 pages. Any idea what I missed?

    2. Using a special section with a column on the left side just for the menu, some of the shorter menu items are being combined into one line where they will both fit. Is there any way to force each item to a new line?

    Thanks.

    Reply
    • I found that Divi has a left column navigation pane built into it, so #2 is no longer a problem. I still haven’t solved issue with the menu links though. Any help would be greatly appreciated!

      Reply
      • Hi Steven! It’s hard to tell without seeing the actual page. But if the CSS ID appears at more than one (1) instance of the page, the anchor link will not work. Try to inspect the page source (View > Developer > View Source in Chrome) and search for #gallery to see if you have duplicate IDs.

        Reply
        • Thanks for the reply, Victor. I was careful when making the IDs not to duplicate any of them.

          I inspected the page, and found 2 instances of the tag, both in the links in the 2 menus on the page. It doesn’t look like the module’s IDs are in the code where the each module is defined. Are they supposed to be? I confirmed that each module still has their own CSS ID in the module settings.

          Thanks.

          Reply
          • Sorry, my mistake. The anchor destination does not contain the # in the code, it should look like in this example:

            div id="my-unique-css-id-here" class="et_pb_row et_pb_row_3"

            So search for id=”my-unique-css-id-here” instead.

          • “div id=” doesn’t appear with any of my linked headings. It seems the CSS IDs were not passed from the module settings to the page code.

Submit a Comment

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