我有一个网页视图,我想将链接颜色蓝色更改为白色。在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 :(得分: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];
答案 1 :(得分:0)
如果要将所有链接颜色更改为白色,可以在css中添加 :
a:link{text-color:#ffffff}
答案 2 :(得分: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;}"