Home > Blockchain >  @media (max-width: 640px) not working for mobile
@media (max-width: 640px) not working for mobile

Time:11-15

This codepen link: https://codepen.io/gianlucaas/pen/bGrmQVO hosts my code for one of my pages for a new website.

the problem is, when I go and test it on mobile (you can try it too, on the codepen link), it looks perfect. you can see the rolex goes to the top right corner (the image) and it looks proper. BUT, when i go to my live link, which is (won't show now for privacy purposes). please see answer that solved issue below...

(ON MY IPHONE), it looks like the desktop application, but it is supposed to look like the phone version! I cannot figure out why for the life of me. Does anyone have any suggestions as to what I could be doing wrong?

CodePudding user response:

You need viewport definition in page header, codepen adds that.

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

CodePudding user response:

In your codepen you've got the max-width at 640px:

@media (max-width: 640px) {

In your live app it's 440px:

@media (max-width: 440px) {
  • Related