<a> Tag — HTML Technical Interview Questions & Answers
Defines a hyperlink to another page, file or location.
<a> Tag
- Defines a hyperlink to another page, file or location.
- <a> is a link. HTML uses this tag so the browser (and screen readers) know what the piece is, not only how it looks.
- Board: <a href="/marks">Marks</a> Put it in body. Check it in the browser. Attributes go on the opening tag.
- Trap: button with no href / missing href. CSS can still style it — don’t pick a tag only because of default italics.
- Interview: name the tag, one attribute if it has a famous one (href, src, alt, for, type), one mistake.
Technical Interview Tip: <a>: a link. Example: <a href="/marks">Marks</a>
Code Examples for <a> Tag
<a> Tag — working example
<a href="https://gocareergo.com" target="_blank" rel="noopener noreferrer">
GoCareerGo
</a>
<a href="/preparation/information-technology/html">HTML prep (relative)</a>
<a href="mailto:hello@example.com">Email us</a><a> Tag — href sets destination; target=_blank needs rel=noopener; relative paths stay on-site.
How to Explain <a> Tag to an Interviewer
What is the <a> tag?
a link <a href="/marks">Marks</a>
One common mistake?
button with no href / missing href