HTML & CSS Interview Question #15
How do hyperlinks work in HTML?
HTML Fundamentals, Structure, Semantics, Links, Images, Tables & Forms Junior Beginner
Quick Interview Answer
The anchor element creates a hyperlink, and its href attribute specifies the destination. The destination can be another page, a fragment within a page, an email or telephone URI, or another valid URL.
Detailed Explanation
The anchor element creates a hyperlink, and its href attribute specifies the destination. The destination can be another page, a fragment within a page, an email or telephone URI, or another valid URL.
Link text should clearly describe the destination or action. For navigation, a real anchor with an href is preferable to attaching click behavior to a non-interactive element because native links provide keyboard, accessibility, and browser navigation behavior.
Code Example
<a href="/interview/html-css">
HTML & CSS Interview Questions
</a>
<a href="#forms">Jump to Forms</a>
<a href="mailto:support@example.com">
Email Support
</a>