1

Why is my website on mobile showing up like this rather than the content only? Am i missing some CSS? pls not I am using box-sizing:border-box in body. I used some media queries, but the website is so zoomed out and all of the content on the left on mobile view. You can check out the entire website at http://assistantmarcus.ml for the entire front-end.

PS: The page is perfectly zoomed in on mobile mode, its just that the user can easily zoom out making it look real bad. Is it because of the blob i put in?

img

MasterMind
  • 884
  • 8
  • 21
  • Possible duplicate: https://stackoverflow.com/questions/19156510/responsive-website-zoomed-out-to-full-width-on-mobile – isherwood Mar 10 '21 at 14:38
  • @isherwood okay, ill keep the giude in mind next time i ask. Also, that question linked didn't help me. – MasterMind Mar 11 '21 at 14:38

3 Answers3

1

Whenever you paint content outside the viewport, the browser will allow the user to scroll to it, on both directions.

By setting .blob's width to 150% on screens below 600px and to 290% on screens below 450px, you are rendering content outside the current viewport width, thus creating a horizontal scrollbar.

Since the content painted outside the viewport on the horizontal axis is irrelevant (you're only interested in the part of the enlarged element rendered inside the viewport), you probably want to disable horizontal scrolling on the body element:

body {
  overflow-x: hidden;
}

See it here.


Side note: another way to enlarge .blob would have been to transform it, instead of setting its width and height:

@media (max-width: 600px) {
  .blob {
    transform: scale(1.5);
  }
}
@media (max-width: 450px) {
  .blob {
    transform: scale(2.9);
  }
}

I'm not just mentioning it, I'm recommending it. Using transform vs sizing or positioning has the big advantage of only happening in the compositor layer, without any effect on the layout and paint layers, which brings a big performance increase, especially when dealing with animations. This is well documented all over the web and I tried my best at explaining the mechanics here.

tao
  • 82,996
  • 16
  • 114
  • 150
0

You are most likely missing the viewport tag inside your html head:

<head>
…
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
…
</head>
rauberdaniel
  • 1,017
  • 9
  • 22
0

user-scalable=no in the meta tag helps to disable page zoom-in & zoom-out

<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
Mahesh YL
  • 124
  • 4
  • It zooms in correctly, but there's still a lot of empty space left where it's not zoomed and the user can still zoom out into it – MasterMind Mar 11 '21 at 06:29