Html 如何删除链接点击时的轮廓?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/34635588/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 18:44:08  来源:igfitidea点击:

How do I remove outline on link click?

htmlcsshyperlinkoutline

提问by SaturnsEye

When I click a link on my website it is creating an outline around the link like so

当我点击我网站上的链接时,它会围绕链接创建一个大纲,如下所示

enter image description here

在此处输入图片说明

I've tried adding:

我试过添加:

a.image-link:focus { outline: 0; }

and

a {outline : none;}

But nothing seems to get rid of it. Is there a way to remove it?

但似乎没有什么能摆脱它。有没有办法去除它?

回答by Nuno Bentes

You can just use this:

你可以使用这个:

a:active, a:focus {
  outline: 0;
  border: none;
  -moz-outline-style: none;
}

回答by Rajeev Raushan Prasad

Just add a:visited { outline: none; }in your style file.

只需添加a:visited { outline: none; }您的样式文件。

回答by Pullat Junaid

Simply add outline:none; text-decoration:none;

只需添加轮廓:无;文字装饰:无;

回答by Vijayendra Shah

If at-least one of the solutions above doesn't work for anyone. Give this a try as well

如果至少上述解决方案之一对任何人都不起作用。也试试这个

a:active, a:focus {
 box-shadow: none;
}

回答by SaturnsEye

Fixed:

固定的:

Found out in my CSS that there was code already being generated to create an outline on a:active. This was overriding my code and removing it fixed the problem.

在我的 CSS 中发现已经生成了用于在a:active. 这是覆盖我的代码并删除它解决了问题。

回答by IsleBeeGun

When you are dealing with a bunch of frameworks/modules, there could be multiple layers of divs - not all of them are reachable via class names.

当您处理一堆框架/模块时,可能会有多个 div 层 - 并非所有层都可以通过类名访问。

This bomb works for me:

这个炸弹对我有用:

*:focus {
    outline-width: 0px !important;
  }