Pav Sidhu
Pav Sidhu

Reputation: 6944

Font-size changes on contenteditable div

I have this JSFiddle which shows my issue. When you focus on the contenteditable div, and press the 'list' button, the font will increase. This is because I set font-size: 2em; in the div. If I set this to pixels it is fine however I would like to set it to an 'em' value for scaling.

Is there a way to maintain the font size in ems? Thanks.

Upvotes: 2

Views: 1662

Answers (1)

stalin
stalin

Reputation: 3464

Change the unit from em to rem

while em is relative to the font size of its direct or nearest parent, rem is only relative to the html (root) font-size

See the difference here Rem Vs Em

Upvotes: 1

Related Questions