Html 如何删除html中点击元素周围的虚线
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13195081/
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
how to remove the dotted line around the clicked a element in html
提问by hguser
I found that if there is a a
link in the page which does not link to a new page,then when user click it,there will be a dotted line around the element,it will only disappear when user click anything else in the page,how to remove this?
我发现如果页面中有一个a
没有链接到新页面的链接,那么当用户点击它时,元素周围会有一条虚线,只有当用户点击页面中的任何其他内容时它才会消失,如何删除这个?
Example:
例子:
Note the dotted line around the element Section 2
.
注意元素周围的虚线Section 2
。
回答by Sowmya
Use outline:none
to anchor tag class
使用outline:none
到锚标记类
回答by Mark
Like @Lo Juego said, read the article
就像@Lo Juego 说的,阅读文章
a, a:active, a:focus {
outline: none;
}
回答by Lo Juego
回答by Akash
Try with !important
in css
.
尝试使用!important
in css
。
a {
outline:none !important;
}
// it is `very important` that there is `no` `outline` for the `anchor` tag. Thanks!
回答by OldTrain
To remove all doted outline, including those in bootstrap
themes.
删除所有虚线轮廓,包括bootstrap
主题中的轮廓。
a, a:active, a:focus,
button, button:focus, button:active,
.btn, .btn:focus, .btn:active:focus, .btn.active:focus, .btn.focus, .btn.focus:active, .btn.active.focus {
outline: none;
outline: 0;
}
input::-moz-focus-inner {
border: 0;
}
Note: You should add link href for bootstrap css before the main css, so bootstrap doesn't override your style.
注意:您应该在主 css 之前为 bootstrap css 添加链接 href,这样 bootstrap 不会覆盖您的样式。
回答by chankruze
Removing outline
will harm accessibility of a website.Therefore i just leave that there but make it invisible.
删除outline
会损害网站的可访问性。因此我只是将其留在那里但使其不可见。
a {
outline: transparent;
}
回答by Andrew
回答by loyola
Its simple try below code --
它的简单尝试下面的代码 -
a{
outline: medium none !important;
}
If happy cheers! Good day
如果快乐欢呼!再会