开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜