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

Paola Palencia
Paola Palencia
2,753 Points

meta tag explanation please

Its not entirely clear to me why we need this meta tag, and what the information in it is telling the browser. Anyone care to help me understand this please?

2 Answers

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.

:)

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Anil is correct about the viewport. But the meta tag is much more than that. It contains information about copyright, content, keywords, helps search engines find your site, encoding, and language (just to name a few). You can think of it as the information about the document. It's a little like the beginning of a book where the first few pages are all information about the book (ie publisher, copyright etc.).