Is it possible to get rid of border-top property in the second line of a list item on hover?
<ul>
<li><a href="#">This is a<br/>long Link</a></li>
</ul>
- Display:block causes the border has the same width like the whole element
- Display:inline-block causes nearly same results
By the help of @Pete and the others I ended up with this:
$('#access a').each(function() {
$(this).contents().filter(function() {
return this.nodeType == 3;
}).wrap('<span></span>');
});
to simply wrap the <li>
contents with <span>
elements:
<!-- with the javascript -->
<nav id="access" role="navigation">
<ul id="menu-primary" class="menu">
<li class="menu-item">
<a href="http://www.url.com"><span>Hello</span><br/><span>World</span><a/>
</li>
</ul>
</nav>
This makes it possible to create a hover only for the first span element of the li element:
.mainmenu ul a:hover span:first-child {border-top:1px dotted #fbf9ef;}