href
The destination: page, file, section, email, phone or protocol URL.
Learn href, target, rel, download, hreflang as part of the HTML attribute system: what they configure, where they belong and which mistakes to avoid.
Links
A link without href is just text with link styling. The href attribute gives it a destination. Other link attributes control new tabs, downloads, relationship hints and security behavior.
Because links move people through a site, link attributes affect usability, SEO, accessibility and trust.
href, target, rel, download, hreflang. Attributes that decide where links go and how safely they open. What belongs here
hrefThe destination: page, file, section, email, phone or protocol URL.
targetControls where the link opens, such as _blank for a new tab.
relDescribes the relationship and can improve security with noopener.
downloadSuggests that the browser downloads the file instead of navigating.
Syntax in context
Use descriptive link text and add rel="noopener" when target="_blank" opens an external page.
<a href="/html/elements/">Learn HTML elements</a> <a href="https://example.com" target="_blank" rel="noopener"> Open external reference </a>
Good versus weak
<a href="/html/elements/">Learn HTML elements</a> <a href="https://example.com" target="_blank" rel="noopener"> Open external reference </a>
<a onclick="goSomewhere()">Click here</a> <a href="https://example.com" target="_blank">External site</a>
Rules that matter
The link text should make sense without reading the full paragraph around it.
Use rel="noopener" with target="_blank" for external links.
href="#section-id" jumps to an element with that id.
If it navigates, use a. If it performs an action, use button.
Production thinking
Attributes are small, but they change how an element works. A good attribute can make a link usable, an image understandable, a form easier to complete or a script safer to load.
Screen reader users often navigate link by link. Descriptive link text is more useful than "click here".
Broken href values create dead ends. Link checks and stable URLs matter on real sites.
Live code lab
Edit the HTML or CSS, then use Run to refresh the preview. The preview is isolated, so links and forms stay inside this practice area.
Mini assignment
Practice assignment
Try it yourself
Self-check
Do not only read this page. Answer these questions out loud or write the answers in your own notes. If one answer feels vague, revisit the examples before moving on.