使用 CSS 去除活动链接周围的虚线
我们可以声明激活/选中链接的 outline CSS 属性为 none,以消除超链接默认的主动或焦点状态周围显示虚线轮廓的行为。
解决方案
a, a:active, a:focus {
outline: none;
}示例
让’看一个示例,了解如何去除活动链接周围的虚线:
<!DOCTYPE html>
<html>
<head>
<title>Remove dotted line around links using css</title>
</head>
<style>
div {
color: #000;
padding:20px;
background-image: linear-gradient(135deg, #dc3545 0%, #9599E2 100%);
text-align: center;
}
a, a:active, a:focus {
outline: none;
}
</style>
<body>
<div>
<h1>HTML Links Demo</h1>
<a href="https://google.com" target="_blank">Go To Google</a>
</div>
</body>
</html>输出
以下是上述代码的输出:
应用解决方案之前

应用解决方案之后

广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP