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

Mark Bacolcol
Mark Bacolcol
7,354 Points

Mobile Site is Not Filling Screen?

Despite adding...:

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

...in the HTML head, when viewing the site portrait on mobile (iPhone) it doesn't fill the width of the screen. The entire page is scaled but it only takes up 70ish% of the screen and remaining is a white bar to the right. I have elements that are set to 100% width, so I don't think that's the issue. How can this be fixed?

Thanks

Mark Bacolcol
Mark Bacolcol
7,354 Points

Update - It actually works out better removing the meta tag. But it's weird that what I see on mobile is different from what I see after resizing a browser window on desktop. If someone could explain this, that would be great.

Julie Myers
Julie Myers
7,627 Points

Take maximum-scale attribute out, so your meta tag looks like this:

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

The initial-scale attribute controls the zoom level when the page is first loaded.

The maximum-scale, minimum-scale, and user-scalable attributes control how users are allowed to zoom the page in or out. You typically don't want to set these, as they tend to be buggy.

See this link for more info: http://www.w3schools.com/css/css_rwd_viewport.asp

Mark Bacolcol
Mark Bacolcol
7,354 Points

Thanks for the answer, turns out I had to work on my media queries.