Re: Breadcrumbs: Last Item Not Hyperlinked

Irfanullah Jan scripsit:
> However, I want to remove the <a> element from the last item, because I
> think it is unnecessary to link to current page.

You might keep the <a> element, just remove its @href attribute. The 
HTML5 spec says, “If the a element has no href attribute, then the 
element represents a placeholder for where a link might otherwise have 
been placed, if it had been relevant.” 
[http://www.w3.org/TR/html5-author/the-a-element.html#the-a-element]


>     <a href="category/books-literature.html">Literature & Fiction</a> >

You’d better escape the ampersand. Your mark-up might look like

<div itemprop="breadcrumb">
   <a href="category/books.html">Books</a> >
   <a href="category/books-literature.html">Literature &amp; Fiction</a> >
   <a>Classics</a>
</div>

or as a list

<ol itemprop="breadcrumb">
   <li><a href="category/books.html">Books</a></li>
   <li><a href="category/books-literature.html">Literature & 
Fiction</a></li>
   <li><a>Classics</a></li>
</ol>

with style

[itemprop="breadcrumb"] li:not(:last-child)::after { content: ' >' }

Cheers,
Gunnar

Received on Friday, 10 February 2012 14:49:28 UTC