JavaScript · Middle · Question 72 of 75

Why does el.style.width return an empty string for a width set in CSS?

Explanation

Computed styles return resolved values in pixels. Reading them forces style/layout calculation, so avoid doing it in tight loops.

Further reading

Problem with a question

JavaScript · Middle · question 72

Test yourself

Take the JavaScript · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz