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

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

问题描述

当您在iOS的Safari中点击(触摸)链接时,您会在链接后面留下一个灰色背景(仅在握住它时)。有没有办法删除iOS Safari使用CSS的这个功能?

When you click (touch) a link in Safari for iOS, you get a grey background behind link (only while you're holding it). Is there a way to remove this feature of iOS Safari 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链接上点击的灰色背景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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