Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

HTML How to Make a Website Responsive Web Design and Testing Adjust the Profile Page and Header

What is <meta name = "viewport" content = "width=device-width, initial-scale=1.0">

Could someone provide some useful links for what the "viewport" thingy is?

I don't really understand it and would like some help. Why would one have to do this? What does Nick mean when he says that "the mobile layout will render on desktop devices"? Btw what does he mean when he says "render"?

Someone help please?

2 Answers

Hey Colin,

The viewport meta tag tells the browser that the width of the screen should be considered the "Full Width" of the page. Meaning no matter the width of the device you are on, whether on desktop or mobile. the website will follow the width of the device the user is on. You can read more about the viewport meta tag at W3Schools.

In regards to the term "render". Nick is speaking about the output of the website. when we create html files. the browser "renders" that code to the browser. Once we add CSS and refresh the browser, the browser "Renders" those css Styles.

In simple terms, he means the browser converts the code to a visual layout.

anil rahman
anil rahman
7,786 Points

The meta tag helps control the mobile layout of the webpage. The first part, viewport is the users visible area of the web page. The viewport will vary between devices and be smaller on mobile. This meta tag basically helps let us take control of this viewport.

width=device-width sets the webpages width to the width of the device screen. initial-scale=1.0 sets the initial zoom level of the webpage when it's loaded.

Without this meta tag you would notice everything on a mobile would be very small and squeezed to fit the content to look the same as it does on a monitor.

But also the meta tag itself is a lot more than that. It is like information about your webpage and also helps with search engine optimisation for your webpage.

:)

thanks!