user2545330
user2545330

Reputation: 408

Vertical aling text in UIWebview ios7

I want to vertical-aling my text in UIWebview:

NSString *htmlString = [NSString stringWithFormat:@"<html><head></head><body> <div style=\"margin: 0 auto; text-align: center; height: 7em; line-height: 7em;background-color: %@; font-size: 25px; color:white\">%@</div></body></html>", myColor, string];
[self.webView loadHTMLString:htmlString baseURL:nil];

enter image description here

It vertical align, but it have a white border. I don't know what it is.

Upvotes: 0

Views: 597

Answers (1)

Rajesh Choudhary
Rajesh Choudhary

Reputation: 1340

Try this...

  NSString *htmlString = [NSString stringWithFormat:@"<html><head></head><body style=\"width:100%%; margin:0px\"> <div style=\"margin:0 auto; width:100%%; text-align: center; height: 7em; line-height: 7em;background-color: %@; font-size: 25px; color:white\">%@</div></body></html>", @"#111111", @"Hello World...!!!"];
[webView loadHTMLString:htmlString baseURL:nil];

Upvotes: 1

Related Questions