HTML5 icon indicating copy to clipboard operation
HTML5 copied to clipboard

Hyperlinks

Open sivaramakrishna13 opened this issue 1 year ago • 0 comments

Understanding Hyperlinks in HTML

Understanding Hyperlinks in HTML

In HTML, hyperlinks are created using the <a> (anchor) tag. The href attribute specifies the URL of the page the link goes to, and the target attribute specifies where to open the linked document.

Basic Hyperlink

A basic hyperlink is created by using the <a> tag with the href attribute.

Visit Example.com

In the above example, clicking the link will take you to https://www.example.com.

Open Link in a New Tab

To open the link in a new tab, use the target="_blank" attribute.

Visit Example.com in a New Tab

In the above example, clicking the link will open https://www.example.com in a new tab.

Open Link in the Same Frame

To open the link in the same frame (default behavior), use the target="_self" attribute.

Visit Example.com in the Same Frame

In the above example, clicking the link will open https://www.example.com in the same tab or frame.

Open Link in a Parent Frame

To open the link in the parent frame, use the target="_parent" attribute. This is useful when dealing with frames.

Visit Example.com in the Parent Frame

Open Link in the Full Body of the Window

To open the link in the full body of the window, use the target="_top" attribute. This is also useful when dealing with frames.

Visit Example.com in the Full Body of the Window

Relative Links

Links can also be relative, pointing to other pages within the same website.

Contact Us

In the above example, clicking the link will take you to the contact.html page within the same website.

Email Links

You can also create a link to send an email using the mailto: scheme.

Send an Email

In the above example, clicking the link will open the default email client to send an email to [email protected].

Conclusion

Hyperlinks are a fundamental part of HTML, allowing users to navigate between different pages and resources. By using the href attribute, you can specify the destination of the link, and by using the target attribute, you can control where the link opens.

sivaramakrishna13 avatar Dec 31 '24 01:12 sivaramakrishna13