Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hyperlinks #12

Open
sivaramakrishna13 opened this issue Dec 31, 2024 · 0 comments
Open

Hyperlinks #12

sivaramakrishna13 opened this issue Dec 31, 2024 · 0 comments

Comments

@sivaramakrishna13
Copy link

sivaramakrishna13 commented Dec 31, 2024

<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 [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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant