Skip to main content
All CollectionsTroubleshooting and FAQsFrequently Asked QuestionsGeneral
How to Add Anchor Links to Specific Sections Inside the Same Page Layout
How to Add Anchor Links to Specific Sections Inside the Same Page Layout

Learn how to create anchor links by assigning unique IDs to sections and linking to them from your menu, buttons, or text links.

Updated over 5 months ago

Anchor links are powerful tools for improving navigation and user experience. They allow visitors to jump to specific sections within the same page.

In this article, we will guide you through the process of adding anchor links to specific sections inside the same page layout using Divi.

Example

Considering the following two Menu items:

  1. About Us - will scroll to a section with the about-us CSS ID set.

  2. Our News - will scroll to a section with the our-news CSS ID set.

Add the Anchor links to your WordPress menu

  1. Go to Appearance → Menus

  2. Select the menu to which you want to add anchor links

  3. From the left sidebar, choose Custom Links

  4. In the URL  field, enter the CSS ID of the element you want to scroll to

  5. Enter the text in the Link Text field

    WordPress Create/Edit a WordPress Menu

  6. Save your changes by clicking on the Save Menu button

Examples:

  • About us menu items:

    • URL will be #about-us

    • Link Text will be About us

  • Our News menu item:

    • URL will be #our-news

    • Link Text will be Our News

WordPress Anchor Links Menu items

Create the WordPress Widget​

  1. Go to Appearance → Widgets

  2. Create a new Custom Widget Area

  3. Add the Navigation Menu widget to this new Widget Area

    WordPress Navigation Widget

Display the Navigation Menu widget on your page

  1. Edit the page to where you want to add the Anchor Links

  2. Add the Sidebar Module

  3. In the Sidebar's module Content Tab → Content → Widget Area, select the WordPress Widget area created previously

  4. Go to Design Tab → Layout and deactivate the Show Border Separator option

Add the CSS ID to your section

  1. For each section, the Anchor links need to scroll open their settings by clicking on the Gear icon

  2. Go to Advanced Tab → CSS ID & Classes → CSS ID

  3. Type in each ID

    Divi - Set CSS ID

Note: Considering the example above, each of those two sections related to the About Us and Our News will have the following CSS IDs:

  • About Us section → about-us

  • Our News section → our-news

Alternative methods

Use the Code module and custom HTML code

  1. On your page, add the Code module

  2. Inside the Code module's Content Tab → Text → Code using this HTML code

    <ul>
    <li> <a href="#about-us">About Us</a> </li>
    <li> <a href="#our-news">Our News</a> </li>
    </ul>

Use the Text Module to create anchor links

  1. On your page, add the Text module

  2. Inside the Text module's Content Tab → Text → Body, add the Anchor links' text

    Divi Text module

  3. Select each of those text and click on the Link icon

  4. For each link, type in the section's CSS ID to which you want to scroll

    WordPress - add links to text elements
Did this answer your question?