I want to give gradient to UIwebview’s background which I load as:
[self.webView loadHTMLString:customHtml baseURL:nil];
but this html line does not give the effect, anyone knows how to do this better or can fix this css?
[customHtml appendString:[NSString stringWithFormat:@"%@ ", @" <body style='background-color:#4b95bf; webkit-gradient(linear, left top, left bottom, from(#55aaee), to(#003366));'>"]];
The CSS is incorrect
webkit-gradient()is not a property, rather it-webkit-gradient()is a value.Rather the HTML should contain:
Note the
-before thewebkit-gradientand thebackground-image: