I want underline to be removed from a link. Also I want underline to appear when I hover it with my mouse pointer. How can this be done? Pls help.
No hover:
When I hover the Login
link:
Using HTML, CSS create an animated underline effect when the user hovers over the text. Use display: inline-block to make the underline span just the width of the text content. Use the :after pseudo-element with width: 100% and position: absolute to place it below the content.
Change the underline to dots with the border-bottom style property a { text-decoration: none; border-bottom:1px dotted; }. Change the underline color by typing a { text-decoration: none; border-bottom:1px solid red; }. Replace solid red with another color.
You need to turn off the CSS property text-decoration
for the link and then use the :hover
dynamic pseudo class to add the text-decoration
back when hovering.
a {
text-decoration:none;
}
a:hover {
text-decoration:underline;
}
Demo
Also, you might also need to style the :visited:hover
pseudo class so that the underline appears on links a user has already visited. link order in css is a good answer because the order of the CSS rules matters.
Assuming your login link has the id login
...
#login {
text-decoration: none;
}
#login:hover {
text-decoration: underline;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With