⽤css去掉a标签点击时的默认背景⾊
我们在写移动端html页⾯时,经常⽤a标签写成按钮,但是点击⽤a标签写成的按钮时,有默认的背景⾊,如果我们不想要这个默认背景⾊怎么办?
以下提供⼏种⽅法供⼤家参考:
1. 取消a标签在移动端点击时的蓝⾊:
-webkit-tap-highlight-color: rgba(255, 255, 255, 0);
-webkit-user-select: none;
-moz-user-focus: none;
-moz-user-select: none;
css去掉滚动条
2. 使⽤图⽚作为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;
}
3. 改变选中内容的背景颜⾊:
::selection {
background: #FFF;
color: #333;
}
::-moz-selection {
background: #FFF;
color: #333;
}
::-webkit-selection {
background: #FFF;
color: #333;
}
4. 去除ios input框点击时的灰⾊背景:
-webkit-tap-highlight-color:rgba(0,0,0,0);

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。