why is 100% width body or div wider than the screen on mobile?

I\'d been struggling with this one for quite a bit. I figured it was something stupid, but no matter what I did, whenever I set the width of my body, html, and/or div tag to 100% (I\'d totally stripped down my testing page to the simplest of elements to see why it wasn\'t working), the page still extended far beyond the width of the screen when viewed on a mobile device. As it turns out, I was missing the following:

<meta name="viewport" content="width=device-width; initial-scale=1.0;" />

I plunked that in, and problem solved! My website is now truly, 100% wide!




Related Posts


Fixed Position Div Isn't Staying Fixed When Scrolling on Android

My nice fixed position toolbar wasn't sticking as it should as I scrolled through on my mobile browser window...
Read Post

Simple Sticky Element

The user scrolls down the page and once the scrolling reaches the top of an element of my choosing, that element sticks to the top of the window, so it's always visible from that point on...
Read Post

Chrome displays a different height than what Chrome says the height should be.

I was changing the height of an element, but no matter where I specified the height, it wasn't displaying what I was putting in
Read Post

A Nicer Select Dropdown

Better select boxes are all over the internet, but I actually couldn't find one that I liked, and that worked for what I needed...
Read Post