Ben
Ben

Reputation: 4959

CSS font-size does not work after setting body.style.fontSize

After setting document.body.style.fontSize to a certain size using an window.onload function, all elements under body have the same size, even thought I have specified in their CSS class that their font-size should be 40% of their parent element.

What could be the reason?

Upvotes: 1

Views: 932

Answers (1)

Marc Plano-Lesay
Marc Plano-Lesay

Reputation: 6958

The JavaScript modification comes after the CSS has been loaded. So all elements in your body are impacted. You should apply your modification to just the bunch of elements you want to modify.

Upvotes: 4

Related Questions