+ 1

What is viewport in HTML5

7th May 2017, 6:02 AM
prakhar dixit
prakhar dixit - avatar
2 Answers
+ 18
The viewport is the user's visible area of a web page. The viewport varies with the device, and will be smaller on a mobile phone than on a computer screen. Before tablets and mobile phones, web pages were designed only for computer screens, and it was common for web pages to have a static design and a fixed size. Then, when we started surfing the internet using tablets and mobile phones, fixed size web pages were too large to fit the viewport. To fix this, browsers on those devices scaled down the entire web page to fit the screen. :-)
7th May 2017, 6:15 AM
Dev
Dev - avatar
+ 6
You can have other viewport contexts, as in <svg> element ( wich have even a 'viewport' attribute ^^ ), following the same concept still well explained by @Dayve: the display zone of the concerned context ( outside will be cropped/hidden ), eventually handling its own origin/axis system...
7th May 2017, 6:58 AM
visph
visph - avatar