微语:代码适合中午敲,早晚出BUG
去掉点击div的蓝色背景 前端
做项目的时候发现点击div后有个蓝色的背景,不喜欢,找了很多办法,最后发现了有用的,记录一下。
div:focus{
outline: none;
}
清除a标签点击时的高亮
a {
-webkit-tap-highlight-color: rgba(255, 255, 255, 0);
-webkit-user-select: none;
-moz-user-focus: none;
-moz-user-select: none;
}
a标签中包含图片,即点击图片触发超链接时,去掉触发touchstart出现的灰色背景
a,a:hover,a:active,a:visited,a:link,a:focus{
-webkit-tap-highlight-color:rgba(0,0,0,0);
-webkit-tap-highlight-color: transparent;
outline:none;
background: none;
text-decoration: none;
}
去掉ios图片被选中的蓝色背景
img {
-webkit-tap-highlight-color:rgba(0,0,0,0);
-webkit-tap-highlight-color: rgba(255, 255, 255, 0);
-webkit-user-select: none;
-moz-user-focus: none;
-moz-user-select: none;
user-select: none;
}