Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS

viewport

hello can somebody explain to me what is viewport?

2 Answers

Hiya there! "Viewport" is kinda like a virtual windows which renders a web page in Mobile browsers. It lets developers control viewport's size and scale. When i say viewport i mean "viewport meta tag".

A typical mobile optimized website contains this code:

<meta name="viewport" content="width=device-width, initial-scale=1">

Where, The width property controls the size of the viewport. It can be set to a specific number of pixels like width=600 or to the special value device-width which is the width of the screen in CSS pixels at a scale of 100%. The initial-scale property controls the zoom level when the page is first loaded. The maximum-scale, minimum-scale, and user-scalable properties control how users are allowed to zoom the page in or out.

Thank you Ari