以下DHTML格式命令在IE,Firefox和Chrome中使用contentEditable=true
的div上均可以正常运行:
document.execCommand("superscript", false, null);
document.execCommand("subscript", false, null);
但是,再次调用该命令以删除格式在Chrome中无效。
我是否缺少某些东西,或者这是Chrome中的错误?
最佳答案
我有一个类似的问题。对我而言,问题是由于某些“规范化” CSS更改了sup和sub标签的vertical-align: baseline
所致。覆盖该CSS并将sub设置为vertical-align: sub
,将sup设置为vertical-align: super
修复了该问题。
关于google-chrome - Chrome中的contentEditable上标和下标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5203194/