如何在移动设备上 clicking/tapping 时摆脱盒子?

How to get rid of box when clicking/tapping on mobile devices?

我正在尝试摆脱仅在用户 taps/holds 按 link(按钮) 时才出现在移动设备上的框。我注意到,当我将活动状态颜色设置为我想要的字体颜色时,它似乎也设置了背景颜色。

a:active{outline: none; color: #fff;}

以下是 link 在移动设备上点击前后的样子(在桌面上看起来不错)。

Button before it is clicked Button after it is tapped/held

在我看来,您想删除仅适用于移动设备的颜色 属性。要实现这一点,您可以在 css 中使用 @media only screen and (max-width: 600px) 属性,这将为具有 max-width600px 的所有设备加载 css。在这里您可以找到有关 https://www.w3schools.com/cssref/css3_pr_mediaquery.asp

的更多信息

这是您要找的吗?

-webkit-tap-highlight-color: rgba(255, 255, 255, 0);

-webkit-focus-ring-color: rgba(255, 255, 255, 0);

请记住,这并不适用于所有用户。