When used properly, links can greatly enhance a website’s design as well as its usability. HTML coding can allow you to insert links to other pages on your site, email servers, or other webpages entirely.
Links that are coded in HTML do not appear as a string of URL text, but instead, they are integrated into the text. This is known as using anchor text.
You can insert links using the <a> tag.
<a href=“url”>Anchor Text</a>
<a href=“www.examplesite.com/page1.html”>Page 1</a>
When a user clicks on the anchor text, it will take them to the specified hyperlink. Anchor text does not always need to be actual text, but can be images or other elements.
Image1.jpg will be inserted into the page. If a user clicks on the image, it will act as a hyperlink taking them to the specified URL.
In addition, you can specify how a link opens up to a reader. By default, links will open in the same window when clicked, but adding the target attribute will allow you to specify that any links clicked will open in a new window.
<a href=”www.examplesite.com/page1.html” target=”_blank”>Page 1>
HTML code can also be used to link to email. To link to email, users need to have a desktop mail server installed. Email links use the “mailto:” attribute inside the <a> tag.<a href=”mailto:firstname.lastname@example.org?Subject=Hello”>Email Me</a>
This will create a link: Email Me
This link will take the user to his/her email server and automatically insert the specified email address and subject line. If you use more than one word in the subject= attribute, separate each with %20 to make sure the text is formatted properly. You can also choose to automatically CC or BCC other emails or add body text in the email by adding those attributes into your <a> tag.
<a href=”mailto:email@example.comfirstname.lastname@example.orgemail@example.com&subject=Thank%20You&body=We%20appreciate%20your%20inquiry“>Email Me</a>