I know this doesn't answer how to stop an anchor's before content from being underlined.
But the best work-around I find when I need this behavior is not using a:before
.
HTML:
<nav class="breadcrumb">
<span><a href="#">Test 1</a></span>
<span><a href="#">Test 2</a></span>
<span><a href="#">Test 3</a></span>
</nav>
CSS:
nav.breadcrumb > span:before { content: "> "; }
nav.breadcrumb > span:first-child:before { content: ""; }
So, specifying :before
pseudo-class for the element that wraps the anchor, instead of the anchor itself seems like the best solution at the moment.
Another example if you prefer using lists:
HTML:
<ul class="breadcrumb">
<li><a href="#">Test 1</a></li>
<li><a href="#">Test 2</a></li>
<li><a href="#">Test 3</a></li>
</ul>
CSS:
ul.breadcrumb { margin: 0; padding: 0; }
ul.breadcrumb > li { display: inline; }
ul.breadcrumb > li:before { content: "> "; }
ul.breadcrumb > li:first-child:before { content: ""; }