Lempkin
Lempkin

Reputation: 1588

UIWebView : css ignored

I'm pretty new in objective C I try to pass a NSString containing some html and css to my webview :

[_webView loadHTMLString:htmlString baseURL:nil];

The string :

@"<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01//EN\">\n<html>\n        <head>\n        <style type=\"text/css\">\n            

  body {\n                font-family: \"Gill sans\";\n                font-size: 12pt;\n                color: #808080;\n                margin: 0px;\n            }\n        
  a:link, a.visited, a:active {\n            font-style: normal;\n            color: #ffffff;\n            text-decoration: underline;\n        }\n        
  .accroche {\n            font-size: 19pt;\n            color: #ffffff;\n            text-align : center;\n        }\n        
  #title {\n            \n            text-transform : capitalize;\n        }\n        
</style>\n  

</head>\n    
<body>\n        
<div id=\"title\">Informations Utiles</div>\n        
<p><span class=\"accroche\"><p><a href=\"http://google.fr\">blablah</a>blablablah<br /> blabla<br />blabla <br />&nbsp;</p></span></p>\n    
</body>\n</html>\n"

Sorry about the formatting but i don't want to change it too much as it may hide things. Problem is, on the screen in the simulator, css is just ignored, capitalize wont work, as well as text-align or font-size, anything...

Any idea?

Upvotes: 2

Views: 259

Answers (1)

Pradumna Patil
Pradumna Patil

Reputation: 2220

I have tried this on a real device and it renders correctly. This is a simulator issue :(

I was using Xcode 4.3.2 and the simulator running iOS5.1.

I will raise this as a bug with Apple, but hopefully this answer will help somebody else in the future!

Hope it helps.

Upvotes: 1

Related Questions