HTML <a href=""> tag
- closing tag
- required
- void element
- no
- lives inside
- anywhere in <body>, inline
- typically holds
- the clickable text or content
Where it goes
Around whatever should be clickable: a word, a phrase, even an image. It sits inside a line of text and does not start a new line.
Example
<a href="https://example.com">Visit</a>Open this example in the editor →
Common mistakes
- Writing <ahref=> with no space. The browser reads that as a tag named "ahref", not an <a> with an href.
- Closing it with anything but </a>. A closing tag never repeats the attribute.
- Leaving href empty or missing. Then it is not a link to anywhere.