contentEditable superscript & subscript in Chrome
The following DHTML formatting commands each work fine on a div with contentEditable=true
in IE, Firefox and Chrome:
document.execCommand("superscript", false, n开发者_开发问答ull);
document.execCommand("subscript", false, null);
However, calling the command again to remove the formatting has no effect in Chrome.
Am I missing something or is this a bug in Chrome?
I had a similar problem. For me, the problem was due to some "normalization" CSS altering vertical-align: baseline
for sup and sub tags. Overriding that CSS and setting sub to vertical-align: sub
and sup to vertical-align: super
fixed it.
精彩评论