删除ios safari / chrome / firefox中点击的链接上的灰色背景 [英] remove grey background on link clicked in ios safari / chrome / firefox

查看:219
本文介绍了删除ios safari / chrome / firefox中点击的链接上的灰色背景的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当您点击(触摸)iOS(或Chrome或Firefox)中的链接时,您会在链接后面看到灰色背景(仅在您持有时)。有没有办法使用CSS删除此功能?

When you click (touch) a link in Safari (or chrome or firefox) for iOS, you get a grey background behind link (only while you're holding it). Is there a way to remove this feature using CSS?

请参阅下面的示例图片:

Please see the example image below:

推荐答案

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

Webkit has a specific style property for that: -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);
}

如果你想完全删除突出显示 -

If you want to remove the highlight completely—

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

这篇关于删除ios safari / chrome / firefox中点击的链接上的灰色背景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆