如何更改IOS的文本链接颜色

问题描述:

我发现文本链接颜色有问题,实际上我设置了我的链接颜色为桌面视图的红色。现在,当我在Iphone中看到颜色变成蓝色时。颜色代码后使用!important,但这次的结果相同,请告诉我什么是问题,并给我最好的解决方案。如何更改IOS的文本链接颜色

+0

您是否为响应式设计编写了媒体查询? – Gunaseelan

+0

对不起,我使用媒体查询只有选项卡 –

@media (min-device-width:320px) and (max-device-width:768px) 
{ 
    a {color:#ff0000;} 
} 

如果上面的代码不适合你,一个非常详细的下面的代码可能会解决你的问题,下面给出。

/* ----------- iPhone 4 and 4S ----------- */ 

/* Portrait and Landscape */ 
@media only screen 
    and (min-device-width: 320px) 
    and (max-device-width: 480px) 
    and (-webkit-min-device-pixel-ratio: 2) { 

} 

/* Portrait */ 
@media only screen 
    and (min-device-width: 320px) 
    and (max-device-width: 480px) 
    and (-webkit-min-device-pixel-ratio: 2) 
    and (orientation: portrait) { 
} 

/* Landscape */ 
@media only screen 
    and (min-device-width: 320px) 
    and (max-device-width: 480px) 
    and (-webkit-min-device-pixel-ratio: 2) 
    and (orientation: landscape) { 

} 

/* ----------- iPhone 5 and 5S ----------- */ 

/* Portrait and Landscape */ 
@media only screen 
    and (min-device-width: 320px) 
    and (max-device-width: 568px) 
    and (-webkit-min-device-pixel-ratio: 2) { 

} 

/* Portrait */ 
@media only screen 
    and (min-device-width: 320px) 
    and (max-device-width: 568px) 
    and (-webkit-min-device-pixel-ratio: 2) 
    and (orientation: portrait) { 
} 

/* Landscape */ 
@media only screen 
    and (min-device-width: 320px) 
    and (max-device-width: 568px) 
    and (-webkit-min-device-pixel-ratio: 2) 
    and (orientation: landscape) { 

} 

/* ----------- iPhone 6 ----------- */ 

/* Portrait and Landscape */ 
@media only screen 
    and (min-device-width: 375px) 
    and (max-device-width: 667px) 
    and (-webkit-min-device-pixel-ratio: 2) { 

} 

/* Portrait */ 
@media only screen 
    and (min-device-width: 375px) 
    and (max-device-width: 667px) 
    and (-webkit-min-device-pixel-ratio: 2) 
    and (orientation: portrait) { 
     a { 
     color: #ff0000; 
     } 

} 

/* Landscape */ 
@media only screen 
    and (min-device-width: 375px) 
    and (max-device-width: 667px) 
    and (-webkit-min-device-pixel-ratio: 2) 
    and (orientation: landscape) { 
     a { 
     color: #ff0000; 
     } 

} 

/* ----------- iPhone 6+ ----------- */ 

/* Portrait and Landscape */ 
@media only screen 
    and (min-device-width: 414px) 
    and (max-device-width: 736px) 
    and (-webkit-min-device-pixel-ratio: 3) { 
    a { 
     color: #ff0000; 
     } 

} 

/* Portrait */ 
@media only screen 
    and (min-device-width: 414px) 
    and (max-device-width: 736px) 
    and (-webkit-min-device-pixel-ratio: 3) 
    and (orientation: portrait) { 
     a { 
     color: #ff0000; 
     } 

} 

/* Landscape */ 
@media only screen 
    and (min-device-width: 414px) 
    and (max-device-width: 736px) 
    and (-webkit-min-device-pixel-ratio: 3) 
    and (orientation: landscape) { 
     a { 
     color: #ff0000; 
     } 
} 
+0

先生,你确定这个代码 –

+0

我使用这种类型的代码已经在我的CSS,但我没有解决这个问题。 –

+0

检查它并让我知道 – Gunaseelan

你应该有类似

@media only screen 
and (min-device-width : 375px) 
and (max-device-width : 667px) { 
    a { 
     color: red; 
    } 
} 

ü可以添加 “-webkit-外观:无;”到锚标记,并设置字体颜色,并从代码中删除重要

如:

.link { 
    color: blue; 
    -webkit-appearance: none; 
} 
+0

我已经在我的css中写下这个标签 –

+1

可以使用Fiddle共享代码 –

好吧,我发现我对这个问题的解决方案时,我使用这种类型的meta标签我的文字链接的颜色相同的正如我在css中所描述的那样。

我在标题中使用这个元标记。

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

给定的元标签仅用于在iOS上的Safari浏览器中启用/禁用电话号码。参考检查这个[url](https://developer.apple.com/library/safari/documentation/AppleApplications/Reference/SafariHTMLRef/Articles/MetaTags.html) – Gunaseelan