This article is about how to remove the underline of HTML hyperlinks. It teaches you how to quickly remove the underline of HTML hyperlinks. Finally, there are related code explanations. Let us take a look at this article together.
First of all, we use the basic style of CSS to do the simplest method of removing underline:
html a hyperlink tag, some browsers display underline by default, and some There is no underline. Most of the fonts in the A tag of the anchor text hyperlink are underlined. How to remove the underline from the hyperlink? How to remove underline from html hyperlink?
Removing the underline of the hyperlink anchor text requires CSS style attributes:
text-decoration
Most of the time we know: text-decoration:underline Yes, underline is displayed.
Remove the a tag hyperlink underline code in html:
text-decoration:none a{text-decoration:none}
This can remove the underline effect of hyperlinks in the web page. If you only set this CSS code, the underline will not be removed when the mouse hovers over the hyperlink, and the underline will not be displayed.
To avoid compatibility issues, if you want the hyperlink not to be underlined when the mouse is hovering and clicking, the CSS code is required as follows:
a:hover{text-decoration:none}
The underline will not be displayed when the mouse is moved above the hyperlink.
Complete HTML to remove hyperlink underline - html hyperlink underline removal code:
a{ text-decoration:none} a:hover{ text-decoration:none}
Look at a complete code example:
<!DOCTYPE html> <html> <head> <meta charset=utf-8" /> <title>PHP中文网:取消下划线实例</title> <style> a{text-decoration:none} a:hover{text-decoration:none} </style> </head> <body> 欢迎来到<a href=“m.sbmmt.com”>php中文网</a> </body> </html>
Let's work together Take a look at this rendering in the browser:
# Is the above picture very clear? There used to be an underline on the PHP Chinese website, but now it is gone. , isn’t this a lot more convenient?
There is also the following code about underlines, which you may need:
1.html hyperlinks display underlines by default, and the underlines disappear when the mouse is hovered
a{ text-decoration:underline} a:hover{ text-decoration:none}
2.html removes the underline by default, and displays the underline when hovering the mouse
a{ text-decoration:none} a:hover{ text-decoration:underline}
The above is the method of canceling the underline of the html hyperlink in this article, and there are some related codes, I guess you may use it Got it, if you have any questions, please ask them below.
【Editor’s Recommendation】
How to write html space code? Summary of the expression of html space code
html Is the tbody tag a block-level element? Basic usage of html tbody tag
The above is the detailed content of How to remove the underline of html hyperlink? Here are all the ways to remove the underline from the a tag. For more information, please follow other related articles on the PHP Chinese website!