Skip to content

Hyperlinks #12

@sivaramakrishna13

Description

@sivaramakrishna13
<title>Understanding Hyperlinks in HTML</title> <style> body {font-family: Arial, sans-serif; background-color: #f4f4f4; color: #333; line-height: 1.6; margin: 20px;} h1, h2 {color: #333;} p {margin-bottom: 20px;} a {color: #1a0dab;text-decoration: none;}a:hover {text-decoration: underline;}</style>

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 example@example.com.

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions