Asked • 04/02/19

How do I retrieve an HTML element's actual width and height?

Suppose that I have a `
` that I wish to center in the browser's display (viewport). To do so, I need to calculate the width and height of the `
` element. What should I use? Please include information on browser compatibility.

1 Expert Answer

By:

Gabriel F. answered • 11/06/19

Tutor
5.0 (85)

Full Stack Software Developer and Mentor

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.