有没有办法增加 webKit 中 contentEditable div 的字体大小?
contentEditable 仍然存在许多浏览器不兼容问题,但我想我应该尝试一下,并在我正在开发的 Web 应用程序中大量使用它。在使用它时,我发现了一堆可以通过 execCommand 调用的选项。 contentEditable for Firefox 允许您调用
document.execCommand("increasefontsize",bool,value);
并
document.execCommand("decreasefontsize",bool,value);
以一点更改字体大小。大多数其他主要浏览器,尤其是 WebKit 不支持此功能,您必须设置特定的字体大小。有没有办法绕过这个/hack 来在 WebKit 中增加字体大小?或者有没有办法在选择时获取当前文本的大小?
任何帮助将不胜感激。
contentEditable still has many many browser incompatibilities, but I figured I would give it a shot and am using it a big in a web application I am developing. While working with it, I found a bunch of options that can be called via execCommand. contentEditable for Firefox lets you call
document.execCommand("increasefontsize",bool,value);
and
document.execCommand("decreasefontsize",bool,value);
to change the font size by one point. Most other major browsers, particularly WebKit do not support this and instead you have to set a specific font size. Is there a way to get around this / hack to have increasefontsize work in WebKit? Or is there a way to upon selection, get the size of the current text?
Any help would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
jwysiwyg 似乎使用以下代码:
jHtmlArea 似乎使用以下代码:
抱歉,但我找不到上述任一内容的明确链接。
jwysiwyg seems to use the following code:
jHtmlArea seems to use the following code:
Sorry but I can't find definitive links for either of the above.