views:

404

answers:

1

I have a short plain text string, which might contain a weblink. I load it into UIWebView using loadHTMLString and notice that e.g. font style and size are wrong. Can't find anything else, so I embed text inside ad hoc HTML document with CSS (is this REALLY the only way):

NSString *myHtml = [NSString stringWithFormat:
                    @"<html><head>"
                    "<style type=\"text/css\">"
                    "body{"
                    "font-family: Helvetica;"
                    "font-size: 20px;"
                    "a {color: #FFF;}"
                    "},</style>"
                    "</head><body>%@</body></html>", myText];
[self.myWebView loadHTMLString:myHtml baseURL:nil];    

Problem: Just can't figure out how to change link style. Tried a {color:#fff;}, *:link{color:#fff;} etc. which don't even recall anymore. Nothing changed anything about default link look and feel! Not color, not size, not background, nothing!

Any tips how to have any control whatsoever about how links look like? Would using javaScript be the only possibility?

+2  A: 

You nested the a rule inside the body rule. Move it outside.

Jesper
Beautiful while link, totally unreadable, but finally a change :) Great many thanx! Got to find a better CSS reference book...
JOM
Ups, got too excited: while --> white link...
JOM