2.1 Hyperlinks Flashcards
(10 cards)
What is the <a> tag used for?</a>
The <a> (anchor) tag creates a hyperlink that navigates to another page, section, or resource.</a>
What does the href attribute in <a> specify?</a>
It defines the destination URL or file path for the hyperlink.
What is an absolute path in a hyperlink?
A full URL including the domain name (e.g, https://example.com/page.html).
What is a relative path in a hyperlink?
A path relative to the current file, e.g, about.html or ../folder/page.html.
How do you link to an external website using HTML?
Use <a> Visit Site</a>.
How do you link to another page within your own project?
Use a relative path, e.g, <a> Contact</a>.
How do you link to a specific section within a page?
Use an ID selector, e.g, <a> GO the Section 2</a>.
How do you define a section anchor target?
Add an id attribute to an element, e.g, <h2 id="section2">Section 2</h2>.
How do you make a link open in a new tab?
Add target=”_blank” to the <a> tag.</a>
What are some security best practices with target=”_blank”?
Add rel=”noopener noreferrer” to prevent security vulnerabilities.