A simple solution is to use the color
and border
properties, instead of text-decoration
. You need to set text-decoration: none
first, and then use border-bottom
as the underline for all your links.
style.css
a, a:link, a:visited
{
color: #11bad3;
text-decoration: none;
border-bottom: 1px solid #11bad3;
}
a:hover, a:active
{
background: #00a9c2;
border-color: #00a9c2;
color: #fff;
}
print.css
a, a:link, a:visited
{
border-bottom: 0px;
}
index.html
<link rel="stylesheet" href="assets/css/style.css" type="text/css" media="all">
<link rel="stylesheet" href="assets/css/print.css" type="text/css" media="print">
<a href="#"><span>Link text</span>sub-text</a>
and CSS:a:hover {text-decoration:none;} a:hover span {text-decoration:underline;}
This worked for me. – Stramoniumtext-decoration none
inside thespan
doesn't work. So yes, your solution is pretty much the only way to get around this. – Noreen