Reputation: 1
a:hover {
text-decoration:underline;
}
<div>
<ul>
<li>
<a>
<span class="title1">
title1
</span>
title2 is hover underline
</a>
</li>
</ul>
</div>
How to remove hover style only title1.
title1 is none underline and title is underline;
Upvotes: 0
Views: 2501
Reputation: 84
Try to this link:https://jsfiddle.net/17d80ym3/12/
This also give the correct results
Upvotes: 0
Reputation: 3815
You can use a pseudo element with :before
a {
font-weight: 300;
display: inline-block;
padding-bottom: 2px;
position: relative;
}
a:hover:before{
content: "";
position: absolute;
width:85%;
height: 1px;
left:18%;
bottom: 0;
border-bottom: 1px solid red;
}
<div>
<ul>
<li><a><span class="title1">title1</span>title2 is hover underline</a></li>
</ul>
</div>
Upvotes: 0
Reputation: 11
you are actually telling your link to have underlined text. use a:hover{text-decoration:none;} To style your span within a link you can go deeper: a:hover span{color:blue;} for example.
Upvotes: -1
Reputation: 39322
a:hover {text-decoration:underline;}
.title1 {
display: inline-block;
vertical-align: top;
}
a:hover .title1 {
text-decoration:none;
}
<div>
<ul>
<li><a><span class="title1">title1</span>title2 is hover underline</a></li>
</ul>
</div>
Upvotes: 4