拨开荷叶行,寻梦已然成。仙女莲花里,翩翩白鹭情。
IMG-LOGO
主页 文章列表 如何去除手机上的蓝色样式?

如何去除手机上的蓝色样式?

白鹭 - 2022-02-22 2208 0 0

我正在建立一个网站,除了 iPhone 上的链接外,移动设备中的所有样式都可以正常作业。我已经尝试了这个执行绪中的解决方案:如何去除手机上的蓝色样式?

我试过这个CSS

a[href^="tel"],
span[href^="tel"] {
  color: inherit !important;
  text-decoration: none !important;
  font-size: inherit !important;
  font-family: inherit !important;
  font-weight: inherit !important;
  line-height: inherit !important;
}

还有这个CSS

a[x-apple-data-detectors],
span[x-apple-data-detectors] {
  color: inherit !important;
  text-decoration: none !important;
  font-size: inherit !important;
  font-family: inherit !important;
  font-weight: inherit !important;
  line-height: inherit !important;
}

以上没有对我有用。关于如何使用纯CSS解决此问题以便样式将继承于我的所有网页的任何建议?

更新解决方案

接受的答案将改变所有<span>/<a>元素的默认行为。相反,您应该在元素上使用idclass设定样式。示例可能如下所示:

.lnd-header-button__text{  
    all: initial;
  }

  .lnd-header-button__text * {
   all: unset;
  }

uj5u.com热心网友回复:

你可以通过媒体查询来做到这一点

小心使用精确选择器,因为使用 cssall会影响匹配选择器的所有 css 属性

@media only screen and (max-width: 600px) {
  my-selector {  
    all: initial;
  }

  my-selector * {
   all: unset
  }
}
标签:

0 评论

发表评论

您的电子邮件地址不会被公开。 必填的字段已做标记 *