👀 Live Preview
Click the HTML region to follow the link. The CSS region uses nohref and does not navigate:

Top region: clickable. Bottom region: nohref blocks navigation.

The nohref attribute is a boolean HTML attribute used on <area> elements inside a client-side image map. When present, that hotspot is not a hyperlink—clicks do not navigate. Image maps pair an <img usemap="#name"> with a <map> containing shaped regions. Some regions link with href; others are decorative or reserved for scripting. nohref was the HTML4 way to mark non-link regions. In HTML5 it is obsolete—omit href instead—but you will still encounter it in legacy tutorials and code.
Present = no link.
Image map hotspots.
Client-side maps.
Link or not.
Omit href.
removeAttribute.
nohref AttributeThe primary purpose of nohref is to define image-map regions that should not navigate when clicked. A diagram might label sections visually while only some labels are actual links. Without nohref (or without omitting href in HTML5), an <area> with a missing or empty href could behave inconsistently in very old browsers—hence the legacy attribute.
Today, client-side image maps with usemap, <map>, and <area> are less common than CSS layouts or SVG links, but they remain valid for diagrams and infographics. Understanding nohref helps you read older markup and choose the correct modern pattern for non-interactive hotspots.
Do not use nohref in new projects. Write <area shape="…" coords="…" alt="…"> without href for non-clickable regions. In JavaScript, use removeAttribute("href") rather than setAttribute("nohref", "").
Add the boolean nohref attribute to an <area> inside a <map>:
<img src="diagram.png" alt="Site navigation diagram" usemap="#site-map">
<map name="site-map">
<area shape="rect" coords="10,10,120,80" href="/html" alt="HTML section">
<area shape="rect" coords="130,10,240,80" nohref alt="CSS label (decorative)">
</map>nohref alone; presence means no navigation.<area> elements inside <map>.shape, coords, and descriptive alt like any area.nohref and href on the same area.href entirely on non-clickable areas.area.removeAttribute("href") in JavaScript (preferred over adding nohref).The nohref attribute is boolean—it has no meaningful string value:
nohref — Attribute present; area is not a hyperlink.nohref="" — Also valid in HTML; same as bare nohref.href is set; otherwise behaves as non-navigating in HTML5.href and no nohref — preferred non-link pattern.const area = document.getElementById("hotspot");
// Disable link (modern)
area.removeAttribute("href");
// Re-enable link
area.setAttribute("href", "/destination");| Use case | Markup | Notes |
|---|---|---|
| Clickable hotspot | <area href="..." alt="..."> | Normal link region |
| Non-clickable (HTML5) | <area alt="..."> (no href) | Preferred today |
| Non-clickable (legacy) | <area nohref alt="..."> | HTML4 pattern |
| Disable via JS | area.removeAttribute("href") | Dynamic off |
| Enable via JS | area.setAttribute("href", url) | Dynamic on |
| Image link | usemap="#map-name" on img | Client-side map |
| Element | Supported? | Notes |
|---|---|---|
<area> | Yes | Only element for nohref |
<map> | No | Container; use on child areas |
<img> | No | Uses usemap, not nohref |
<a> | No | Use absence of href or href="#" patterns differently |
nohref vs omitting href vs href| Approach | Example | When to use |
|---|---|---|
| With link | <area href="/page" alt="Go"> | Clickable hotspot |
| HTML5 non-link | <area alt="Label only"> | New projects (preferred) |
| Legacy non-link | <area nohref alt="Label only"> | Reading or maintaining old HTML |
Image map with a linked HTML region and a non-clickable CSS region, JavaScript href toggling, and HTML5 vs legacy markup.
Click the HTML region to follow the link. The CSS region uses nohref and does not navigate:

Top region: clickable. Bottom region: nohref blocks navigation.
One linked region and one region marked with nohref:
<img src="diagram.png" alt="Navigation diagram" usemap="#image-map">
<map name="image-map">
<area shape="rect" coords="253,98,111,1" href="/html/tags/a" alt="Learn HTML">
<area shape="rect" coords="253,250,74,148" nohref alt="CSS label (no link)">
</map>The first <area> includes href and acts as a normal link. The second includes nohref, so the browser treats that pixel region as non-navigating while still part of the map geometry.
Disable a hotspot by removing href rather than adding nohref:
<area id="dynamicArea" shape="rect" coords="253,98,111,1" href="/html/tags/a" alt="Learn HTML">
<script>
function disableLink() {
document.getElementById("dynamicArea").removeAttribute("href");
}
function enableLink() {
document.getElementById("dynamicArea").setAttribute("href", "/html/tags/a");
}
</script>Removing href achieves the same effect as nohref in modern browsers. Restoring href re-enables navigation. Avoid dynamically setting nohref in new scripts.
The modern equivalent of nohref is simply omitting href:
<!-- HTML5 (preferred) -->
<area shape="rect" coords="253,250,74,148" alt="Decorative label">
<!-- Legacy HTML4 -->
<area shape="rect" coords="253,250,74,148" nohref alt="Decorative label">HTML5 defines that an <area> without href is not a hyperlink. The nohref attribute remains for backward compatibility but is not required for new documents.
nohref or without href.img usemap="#name" connects to map.
shape and coords outline each hotspot.
Area present but href navigation disabled.
Some regions link; others do not.
The nohref attribute is recognized in all major browsers on <area> elements for legacy compatibility. HTML5 validators flag it as obsolete. Omitting href is the standards-based approach and works consistently in modern browsers.
nohref compatibilityAll major browsers support the nohref attribute in production use.
Bottom line: Browsers still honor nohref in old pages; write new maps without href instead of nohref.
nohref in new code.alt values.href, not by toggling nohref.coords attribute guide.The nohref attribute marks <area> hotspots that should not navigate in client-side image maps. It is a simple boolean legacy feature from HTML4.
Modern HTML achieves the same result by omitting href. Learn nohref to understand older tutorials and codebases, but apply current best practices when building new pages.
nohrefBookmark these before your next nohref implementation.
Image map hotspots.
ScopeBoolean nohref.
BehaviorHTML5 preferred.
ModernremoveAttribute.
DynamicLink or not.
A11y<area> in an image map as non-clickable. The region exists in the map but does not navigate.<area> only, inside a <map> used with usemap on an <img>.href instead.area.removeAttribute("href"). Restore with setAttribute("href", url). Avoid setAttribute("nohref", "") in new scripts.nohref is an explicit legacy boolean attribute. Omitting href is the HTML5 way to define a non-link area. Both prevent navigation in practice.alt on every <area>, whether or not it links.Practice image maps with nohref, href toggling, and HTML5 omit-href patterns in the Try It editor.
5 people found this page helpful