Categories
Coding

How to Make an Inner Link in a Page

In case you would like to point from one element of your text to another one (word, paragraph, picture, heading…), the easiest way to do it is to make an inner link in the page. Here is the guide, how you can do it easily. You can also copy-paste the code parts as well and insert your text instead of examples.

Step 1.

Make a link.

<a>Example Link</a>

Step 2.

Give the link a target attribute

<a href=””>Example Link</a>

Step 3.

Make an element with an id of your choice. Ours will be “example-id“. This will be used with the link for its target.

<p id=”example-id”>Example Text</p>

Step 4.

Give the link the id you put in the text inside the href attribute. Remember your hashtag (#)!

<a href=”#example-id”>Example Link</a>

Step 5 (optional).

You can make your link to go to a new page by adding “target=”_blank”” into the link.

<a href=”#example-id” target=”_blank”>Example Link</a>

Last Notice.

The speech marks (“”) are the wrong speech marks. You will have to rewrite the speech marks in your code editor e.g. WordPress Custom HTML.

There can never be multiple same ids in one HTML file. There can only be one id in each element. Ids cannot have any special characters except underline (_) and hyphen (-).

There can be multiple same classes in one HTML file and elements can have multiple classes separated by spaces. Classes cannot have any special characters except underline (_) and hyphen (-).

If you need professional help, try checking the internet for websites that teach you HTML/CSS/JavaScript.

You can preview your code in WordPress by making a post, then adding a block, and then choosing “Custom HTML”. Then you can write your code there and then click “Preview” to see what your code does.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.