ContentEditable superscript & subscript in Chrome

The following DHTML formatting commands work fine in a div with contentEditable=truein IE, Firefox, and Chrome:

document.execCommand("superscript", false, null);
document.execCommand("subscript", false, null);

However, calling the command again to remove formatting has no effect in Chrome.

Am I missing something or is this a bug in Chrome?

+5
source share
1 answer

I had a similar problem. For me, the problem arose due to some โ€œnormalizationโ€ of the CSS change vertical-align: baselinefor sup and sub tags. Overriding this CSS and setting sub to vertical-align: subsup and up to vertical-align: superfix it.

+7
source

All Articles