2014-04-29 79 views
1

我有一个网页视图,我想将链接颜色蓝色变为白色。在html标签下面,我正在改变字体的工作状态。请告诉我什么是改变链接颜色的html标签。将链接颜色蓝色变为白色

NSString* htmlContentString = [NSString stringWithFormat: 
              @"<html>" 
              "<style type=\"text/css\">" 
              "body { background-color:transparent; color: #eadfa8;font-family:Arial; font-size:24; }" 
              "</style>" 
              "<body>" 
              "<p>%@</p>" 
              "</body></html>", content1]; 

      [webview loadHTMLString:htmlContentString baseURL:nil]; 
+0

试试我的解决方案 – nicael

回答

0

在CSS中添加a{color:white}

NSString* htmlContentString = [NSString stringWithFormat: 
              @"<html>" 
              "<style type=\"text/css\">" 
              "body { background-color:transparent; color: #eadfa8;font-family:Arial; font-size:24; }" 
"a {color: white;}" 

              "</style>" 
              "<body>" 
              "<p>%@</p>" 
              "</body></html>", content1]; 

      [webview loadHTMLString:htmlContentString baseURL:nil]; 
+0

它不工作。与蓝色相同 – gowtham

+0

对不起更新的东西错了 –

0

如果你想改变所有的链接颜色为白色,你可以在你的CSS 补充一点:

a:link{text-color:#ffffff} 
0

使用下面的代码:

NSString* htmlContentString = [NSString stringWithFormat: 
              @"<html>" 
              "<style type=\"text/css\">" 
              "body { background-color:transparent; color: #eadfa8;font-family:Arial; font-size:24; }" 
              "body.a:link {color:#FFFFFF !important;}" 
              "</style>" 
              "<body>" 
              "<p>%@</p>" 
              "</body></html>", content1]; 

您可以设置如下链接颜色:

"body.a:link {color:#FFFFFF !important;}" 
+0

仍然是蓝色的。为什么? – gowtham

相关问题