What is viewport in HTML? Could you give some examples on how to access the viewport details?
The viewport is the part of the webpage that the user can currently see. The scrollbars move the viewport to show other parts of the page.
Follow this article's instructions to get the viewport dimensions in Javascript.
if (typeof window.innerWidth != 'undefined') { viewportwidth = window.innerWidth, viewportheight = window.innerHeight }
1.4m articles
1.4m replys
5 comments
57.0k users