当在HTML中创建超链接时,默认情况下会显示为带有下划线的蓝色文本。如果想要去掉下划线,可以使用CSS样式来实现。
- html>
- <html>
- <head>
- <style>
- a {
- text-decoration: none;
- color: blue; /* 设置超链接文本颜色 */
- }
- style>
- head>
- <body>
-
- <a href="https://www.baidu.com">没有下划线的超链接a>
-
- body>
- html>
在示例代码中,我们主要是运用css中的 text-decoration: none; 来使超链接去掉下划线。