当您在 iOS 的 Safari(或 chrome 或 firefox)中单击(触摸)链接时,链接后面会出现灰色背景(仅当您按住它时)。有没有办法使用 CSS 删除此功能?
请看下面的示例图片:
当您在 iOS 的 Safari(或 chrome 或 firefox)中单击(触摸)链接时,链接后面会出现灰色背景(仅当您按住它时)。有没有办法使用 CSS 删除此功能?
请看下面的示例图片:
Webkit 有一个特定的样式属性:-webkit-tap-highlight-color
.
复制自:http ://davidwalsh.name/mobile-highlight-color —</p>
/* 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);
}
如果你想完全移除高光——</p>
.myButton {
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
出于某种原因,最新版本的 iOS 忽略了 RGBA 颜色。
要删除它,我最终不得不使用以下内容:
-webkit-tap-highlight-color: transparent;
如此处所述: https ://developer.mozilla.org/en-US/docs/Web/CSS/-webkit-tap-highlight-color