[whatwg] [html5] 2.6.1. The a element

*Ian Hickson <ian at hixie.ch>*:
>
> So what does an <a> element with no href="" represent? Nothing? Or I  
> guess we could make the href="" attribute required.

I frequently use and advice to do navigation lists like this:

   <div><map id="nav"><ul>
     <li><a href="/">Home</a></li>
     ...
     <li><a>Current page</a></li>
     ...
     <li><a href="/contact/">Contact</a></li>
   </ul></map></div>

(I use 'map', because 'menu' is deprecated, and 'div', because in HTML4S  
'map' cannot be a child of 'body'---but let's not get distracted.)

The current page should not link to itself, but for consistency (and  
styling) I like to keep the 'a' element instance, just without an 'href'  
attribute. Elsewhere I also use 'a' instead of 'span', because it's IMHO  
equally meaningful, but shorter. So, no, I don't think 'href' should be  
required for 'a'.

Received on Tuesday, 12 April 2005 12:34:17 UTC