Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Text decoration for link and span inside this link

I have links like:

<a href="#">Link text<span>Link sub-text</span></a> 

When hovering I need that text inside span is not decorated with underline (but main link text is). Is it possible? I've tried:

a:hover span {text-decoration:none;}

This is not working.

Is there any solution for this?

like image 510
wzazza Avatar asked Dec 30 '11 15:12

wzazza


1 Answers

Add link text (text you want to be decorated with underline) inside <span> and the sub-text outside as normal link text, like:
<a href="#"><span>Link text</span>sub-text</a>

To decorate Link text use:

a:hover {
  text-decoration:none;
} 
a:hover span {
  text-decoration:underline;
}  
like image 58
wzazza Avatar answered Sep 19 '22 16:09

wzazza