CSS - 有没有办法在单击链接后摆脱选择矩形?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/179510/
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 20:01:24  来源:igfitidea点击:

CSS - Is there a way to get rid of the selection rectangle after clicking a link?

csshyperlink

提问by Mats

Is there a way to get rid of the selection rectangle when clicking a link which does not refresh the current page entirely?

单击不完全刷新当前页面的链接时,有没有办法摆脱选择矩形?

回答by Ross

Do you mean the dotted outline of a target?

你的意思是目标的虚线轮廓?

Try:

尝试:

:focus {
    outline: 0;
}

This would remove all focus outlines. IT's essentially the same as onclick in JavaScript terms. You might prefer to apply this to a:focus.

这将删除所有焦点轮廓。它本质上与 JavaScript 术语中的 onclick 相同。您可能更愿意将此应用于a:focus.

回答by Lou Franco

Try adding this:

尝试添加这个:

onclick="this.blur()"

Discussed here as well

也在这里讨论

(CSS?) Eliminating browser's 'selected' lines around a hyperlinked image?

(CSS?)消除浏览器在超链接图像周围的“选定”行?