去掉点击div的蓝色背景
时间:2023-5-9 01:53 作者:小诸葛 分类: 前端 正在检查是否收录...
做项目的时候发现点击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;
}
版权说明
推荐阅读:
扫描二维码,在手机上阅读