开发者

Justify text in UIWebView on iPhone OS using inline CSS?

开发者 https://www.devze.com 2022-12-29 07:40 出处:网络
Using CSS in a UIWebView, how can I make left-to right text flow in a justified manner? What CSS am I looking for?

Using CSS in a UIWebView, how can I make left-to right text flow in a justified manner? What CSS am I looking for?

EXAMPLE

<p style='text-align: justify;'开发者_Go百科>

does not work. What goes instead of justify?


just pasted from an old project. I do hope this helps

    NSString *css = [NSString stringWithFormat:
                     @"<html><head><style>body { background-color: transparent; text-align: %@; font-size: %ipx; color: white;} a { color: #172983; } </style></head><body>", 
                     @"justify",
                     16];

    NSMutableString *desc = [NSMutableString stringWithFormat:@"%@%@<br><br>%@<br><br>%@%@", 
                             css,
                             sampleText,
                             sampleText,
                             sampleText,
                             @"</body></html>"];

    UIWebView *webView = (UIWebView *)[self viewWithTag:WEB_VIEW_TAG];
    [webView loadHTMLString:desc baseURL:nil];
0

精彩评论

暂无评论...
验证码 换一张
取 消