HTML uses a hyperlink to connect to another document on the web. Links can be found in almost all pages. Clicking on a link will jump from one page to another.
HTML hyperlink (link)
HTML uses the tag <a> to set a hypertext link, which is a link from one page to another destination.
Hyperlinks can be a word, a word, a group of words, or an image, and you can click on them to jump to a new document or a part of the current document.
When you move the mouse pointer over a link in a web page, the arrow turns into a small hand.
The href attribute is used in the tag <a> to describe the address of the link.
By default, the link will appear in the browser in the following form:
- An unvisited link is displayed in blue font and underlined
- Visited links are shown in purple and underlined
- When clicking on a link, the link is displayed in red and underlined
HTML empty link
HTML empty link: refers to a pointer that points to a link, but the mouse turns into a hand shape, but stays on the current page after clicking.
The temporary added empty links are mainly to better see the final effect.
<a href="#">Link text</a>
Where "#" indicates an empty link.
HTML link syntax
The linked HTML code is simple. It looks like this:
<a href="url">Link text</a>
The href attribute describes the destination of the link.
<a href="https://www.punchi.tech">Visit Punchitech</a>
The above line of code is:: Punchitech
Clicking on this hyperlink will take the user to the Punchitech homepage.
Tip: "Link text" does not have to be text. Images or other HTML elements can become links.
HTML link-target attribute
Using the Target property, you can define where the linked document appears (opens in a new window or opens in an original window).
The following line opens the document in a new window:
<a href="https://www.punchi.tech" target="_blank">Visit Punchitech</a>
Tip: The default linked document will open in the original window. If the target attribute is set to "_blank", the document opens in a new window.
HTML link-id attribute
The id attribute can be used to create bookmark tags in an HTML document.
Tip: Bookmarks are not displayed in any special way. They are not displayed in HTML documents, so they are hidden from the reader.
Insert ID in HTML document:
<a id="tips">Useful Tips Section</a>
Create a link to the "useful tips section (id =" tips ")" in the HTML document:
<a href="#tips">Visit the Useful Tips Section</a>
Alternatively, create a link to the "Useful Tips (id =" tips ") section" from another page:
<a href="//www.punchi.tech/html_links.html#tips"> Visit the Useful Tips Section</a>
HTML Link Tags
|<a>||Define a hyperlink|
HTML Text Formatting