How to make a link in HTML

The Internet hosts millions of electronic documents that are often similar in content and targeted to the same user audience. Switching to other documents would seem difficult and tedious if it were not possible to link HTML documents together using hypertext links.

In fact, any hypertext link is an address in the global network, where you can instantly navigate through the browser window. A successful link is possible in two cases: if the document referenced by the document exists, and if the syntax of the hyperlink is correct from the HTML point of view.

The <a> tag

To create links in HTML documents, the <a> element is used, its contents appear as a label, with which it will be used to navigate. To make an active hyperlink from the <a> element, you need to add the href attribute to it.

The href attribute as its value contains the address (relative or absolute) to which the link will be referenced. When the link is clicked, the browser receives and displays the document whose address is specified in the href attribute:

<p><a href="page.html">Link</a></p>
<p><a href="">Link</a> to the page in Internet.</p>

The result of this example in the browser window:

links in html

How to remove underline from link

All HTML links are displayed underlined. This kind of reference is specified in the styles used by browsers by default. To remove the underline of a link, you need to change the style for it, you can do this in two ways.

The first way is to add a style attribute to the link that you want to remove underline with the value text-decoration:none;:

<a href="page.html" style="text-decoration: none;">Link without underline</a>

The second way will be suitable in case when it is necessary to remove underline at once at all references in the HTML document. In CSS styles, we assign for all <a> elements a text-decoration property with a value of none:

a { text-decoration: none; }
Copying materials from this site is possible only with the permission of the site administration and
when you specify a direct active link to the source.
2011-2018 © | ruen