2012-08-09 94 views
48

当您点击(触摸)iOS的Safari(或Chrome或Firefox)中的链接时,链接后面会出现灰色背景(仅当您拿着它时)。有没有办法使用CSS删除此功能?在ios safari/chrome/firefox中点击的链接上删除灰色背景

请参阅下面的示例图像:

enter image description here

+0

我还没有真正关于Safari的iOS的想法,但是当你在谈论的链接和CSS ,那么我想你最好改变一下背景色:主动 – 2012-08-09 14:05:47

+0

真的很有帮助...... – Chetan 2012-10-17 07:10:17

回答

130

的Webkit有一个特定的样式属性:-webkit-tap-highlight-color

从复制:http://davidwalsh.name/mobile-highlight-color -

/* light blue at 80% opacity */ 
html { 
    -webkit-tap-highlight-color: rgba(201, 224, 253, 0.8); 
} 

/* change it for a div that has a similar background-color to the light blue tap color */ 
.blueDiv { 
    -webkit-tap-highlight-color: rgba(251, 185, 250, 0.9); 
} 

如果你想删除的亮点completely-

.myButton { 
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0); 
} 
+0

令人惊异的是,修复了我的iOS轻拍背景问题 – Simon 2015-12-08 12:36:57

+0

这样一个方便的小声明。谢谢@ pk-nb – danMad 2017-12-29 04:05:42