html - 防止手机变色

标签 html css

我有一个 HTML,其中包含一个带有电话号码的简单段落,但在我的 iOS 测试中,电话号码改变了颜色并转换为电话号码。 转换为电话不会打扰我,但字体颜色的变化是。 如何避免?

这是我的代码示例:

<p class="phone-pink">call 1-888-4HELP <br class="show-for-small-only">(1-888-443-57)</p>

最佳答案

将此添加到您的 html 的头部:

<meta name="format-detection" content="telephone=no">

如上所述,您可以设置链接标签的样式,但如果您只想影响那一行,请执行以下操作:

.phone-pink a[href^=tel] {
  color : inherit;
  text-decoration: none;
}

然后您可以将其更改为一个 id:

<p id="phone-pink">call 1-888-4HELP <br class="show-for-small-only">(1-888-443-57)</p>

和CSS:

#phone-pink a[href^=tel] {
  color : inherit;
  text-decoration: none;
}

查看这些答案以获取更多信息:

How do I remove the blue styling of telephone numbers on iPhone/iOS?

关于html - 防止手机变色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45329808/

相关文章:

html - 页脚覆盖了我的内容

html - 为什么我的 "<li>"在使用 margin-top 时没有移动到顶部

html - 大小绝对 child 到 parent 的宽度

animation - Firefox 和 IE 中的 css 关键帧动画

css - LESS 中的十六进制数学有一个奇怪的观察/结果。为什么会这样呢?

css - 为什么 "clear:both;"CSS 在响应式主题中不起作用?

javascript - <ion-scroll Zooming ="true">-标签似乎不允许在模态对话框中缩放

javascript - 将重复的 JQuery 代码转换为干净的代码

html - 滚动条及其内容隐藏在 div 之外

jquery - 页脚和奇怪的间距和定位