Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS span hover not working

Tags:

html

css

I want to show the dotted line when mouse hover the link, this method doesn't work.

.text-link {
  color: #446CB3;
  font-family: "Tahoma";
  font-size: 15px;
 text-decoration:none;
}
.text-link:hover {
  text-decoration-style: dotted;
}
<a href="URL" target="_blank" data-role="none">
  <span class="text-link">Click me</span>
</a>
like image 329
Prime Avatar asked Aug 28 '26 20:08

Prime


1 Answers

It doesn't look like text-decoration-style: dotted is supported in all browsers:

enter image description here

For full support, you could use border-bottom-style: dotted.

In order for this to work, you need to remove the underline from the anchor element using text-decoration: none. Then just add a border-bottom to the element:

a {
    text-decoration: none;
}
.text-link {
    color:#446CB3;
    font-family:"Tahoma";
    font-size:15px;
    border-bottom: 1px solid;
}
.text-link:hover {
    border-bottom-style: dotted;
}
<a href="URL" target="_blank" data-role="none"><span class="text-link">Click me</span></a>
like image 189
Josh Crozier Avatar answered Aug 30 '26 09:08

Josh Crozier



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!