[英]Changing the font size in a UIWebView
Is it possible to use any javascript command to change the current font size in a UIWebView (content editable, of course)? 是否可以使用任何JavaScript命令来更改UIWebView中的当前字体大小(当然,内容是可编辑的)? I wrote a popup that list font sizes in picas (from 9 to 64), and would like to set the font size to this setting, not to the traditional HTML font-size setting from 1 to 7.
我写了一个弹出窗口,列出了以pica为单位的字体大小(从9到64),并希望将字体大小设置为此设置,而不是将传统HTML字体大小设置从1设置为7。
[webview stringByEvaluatingJavascriptFromString:@“foo()“];
EDIT: So your real question is "What javascript command should I use to change the font size of my HTML?" 编辑:所以您真正的问题是“我应该使用哪个javascript命令来更改HTML的字体大小?” or something like that...
或类似的东西...
document.getElementById
will return an element by its ID. document.getElementById
将通过其ID返回一个元素。 You can then use the element.style.fontSize
property to change its font size. 然后,您可以使用
element.style.fontSize
属性更改其字体大小。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.