
Just as long as there's only one element with that ID on the page.Ī heading with an ID might look like: My Example Heading It doesn't have to be unique across the site. With HTML5, we now can use the ID of any html element.Īs a quick refresher, all elements can have one or more "classes" and can have up to one "ID".Īn ID must be unique to that element on a page. So you may see older articles telling you to do it that way, but that's not correct any more. The "name" parameter of the tag became obsolete with HTML5 ( read the discussion on obsolete tags here). Adding an anchor used to be done with the "name" parameter of an anchor tag, hence the name. How to add an anchorįirst, let's clear up some confusion. First you need to add the anchor, then you need to link to it. The reason we don't use it is because the external anchor link will cause the page to be reloaded, whereas the internal anchor link will just move the view to the desired part of the page.Īdding an anchor link to WordPress is a two-part process. The full external anchor link will still work if you're linking to a different part of the same page. The difference is that you drop the url when you're linking to the same page. If you're linking to a specific part of a different page, you use. If you're linking to a specific part of the same page, you use #specific-part-of-page. Difference between internal and external anchor links We're doing the same thing with the anchor links, just with HTML. If you've worked with CSS, you'll know that we use the hashtag (#) to refer to an id. Part 3 is the name of the specific part of the page, which we'll setup later. Part 1 is the regular URL pointing to the page which has the anchor link. The form of that combination follows this convention:

The basic idea is that the link goes to a specific page, then to a specific part of the page. You often see them in a table of contents as well.

They are particularly useful for long articles, glossaries or technical documents. What is an anchor link or a jump link?Īn anchor link, also called a "jump link", let you jump to a specific part of a webpage. To jump there from another page, use the URL of that page, followed by a hashtag then the ID. To jump to that part of the page from another part of the same page, use a hashtag followed by the ID. How do you add anchor links in WordPress? Add a unique ID to any html element on a page. They make it easier for you to write more comprehensive information and combine multiple small, related pages, without compromising the users' experience. They let you improve the User Experience by directing users to a specific part of a page, rather than making them search for the information. Anchor links are a very useful part of web design.
