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

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

viewport metatag

Hello!

Is there an equal sign (again) between width and device? <meta name='viewport' content='width=device-width, initial-scale=1.0'>

Also, this tag causes the layout to be locked to the size of the window, but so far we have 2 media queries. When does it to lock to the size of the window size?

thanks

1 Answer

riccarda
riccarda
6,116 Points

No, there's no equal sign. It's content = "width=device-width".

This is used because mobile devices would otherwise simply display a scaled down version of the desktop website and therefore pretty much ignore everything written in the media queries. I don't think that you'll be able to see this effect by simply resizing your browser window. This is just something devices with smaller screens do because back in the days, all web pages were designed only for computer screens.

Please feel free to correct me if I'm wrong though.

Edit: If you use Google Chrome you can try it out. Open the Developer Tools (Ctrl+Shift+I on Windows or Cmd+Opt+I on a Mac). There's this little phone symbol. If you click on it, you can see how your website looks on smaller devices. You can even choose an example device from a small list by clicking on the arrow next to "Responsive". The iPhone 6 should be one of the devices that scale down the desktop page without the meta tag if I remember correctly.