Problem Statement
Which CSS property is used to remove the underline from links?
Explanation
The CSS property text-decoration with the value none is used to remove the underline from links. By default, browsers display links with an underline to make them easily identifiable. However, modern web design often removes this underline and uses other visual cues like color, hover effects, or icons to indicate links. If you remove underlines, make sure your links are still easily distinguishable from regular text through color or other styling. This is important for accessibility. You can also add the underline back on hover to provide feedback to users. The text-decoration property can also be set to underline, overline, or line-through for different visual effects.
Code Solution
SolutionRead Only
/* Remove underline from all links */
a {
text-decoration: none;
}
/* Remove underline but add on hover */
a {
text-decoration: none;
color: blue;
}
a:hover {
text-decoration: underline;
color: darkblue;
}
/* Style specific links */
.nav-link {
text-decoration: none;
font-weight: bold;
}