Skip to main content Accessibility Feedback

The Viewport


Get information about the size of an element and its position relative to the viewport.

let app = document.querySelector('#app');
let details = app.getBoundingClientRect();

// logs an object with top, let, bottom, right, height, and width properties

Join the Lean Web Club! Coaching. Courses. Coding resources. Get the skills, confidence, and support you need to learn front-end web development and achieve long-term success.

Find this useful? You can support my work by purchasing an annual membership.