The Anchor Tag

The Anchor Tag

The Anchor Tag

The <a> (or anchor) opening tag is written in the format:

<a href="https://thesoftdesign.com/how-to-start-a-blog/">Your Link Text Here </a>

The first part of the attribute points to the page that will open once the link is clicked.

Meanwhile, the second part of the attribute contains the text which will be displayed to a visitor in order to entice them to click on that link.

If you are building your own website then you will most likely host all of your pages on professional web hosting. In this case, internal links on your website will <a href=”mylinkedpage.html”>Linktle Here</a>.

Let’s Create An Anchor Tag

Let’s try it out. Make a duplicate of the code from your current index.html page. Copy / paste it into a new window in your HTML editor.

Save this new page as “page2.html” and ensure that it is saved in the same folder as your index.html page.

On page2.html add the following code:

<a href="http://www.google.com">Google</a>

This will create a link to Google on page 2. Hit save and return to your index.html page.

On a new line on index.html add the following code:

<a href="*folder(s)*/page2.html">Page2</a>

Ensure the folder path to the file (page2.html) is correct. Hit save and preview index.html in your browser.

If everything is correct then you will see a link which will take you to your second page. On the second page, there will be a link that will take you to google.com.

Share this post

Leave a Reply

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