Media queries not relating to pixels on website

Mobile Technologies Mobile Computing 2 years ago

0 1 0 0 0 tuteeHUB earn credit +10 pts

5 Star Rating 1 Rating
_x000D_ _x000D_ I'm building a responsive site but when I resize the window the media queries aren't corresponding with my screen resolution, so for instance, @media screen and (min-width:640px) and (max-width: 800px) is resulting in these design elements to be when the screen is above 800 pixels and when I'm at 700 pixels my designs are being set to @media screen and (min-width: 400px) and (max-width:640px) for some reason. Does anyone know why this could be happening? Update: The max-width 640px media query is being set to my screen at over 700 pixels still. @media screen and (max-width: 1024px) { .body{ width:800px; } } @media screen and (max-width: 800px) { .body { width:600px; } } @media screen and (max-width:640px) { .body { width:480px; } } @media screen and (max-width:400px) { .body { width:260px; } }

Posted on 16 Aug 2022, this text provides information on Mobile Computing related to Mobile Technologies. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.

Take Quiz To Earn Credits!

Turn Your Knowledge into Earnings.

tuteehub_quiz

Answers (1)

Post Answer
profilepic.png
manpreet Tuteehub forum best answer Best Answer 2 years ago
_x000D_ To start troubleshooting, double check that in the head of your document you have Let me know how you get on. Edit Thanks for the extra code. Check out this working example. The CSS and the order of the media queries is below: /* set default */ .body{ width:800px; } @media screen and (max-width:400px) { .body { width:260px; } } @media screen and (min-width: 401px) and (max-width:640px) { .body { width:480px; } } @media screen and (min-width: 641px) and (max-width: 800px) { .body { width:600px; } } @media screen and (min-width: 801px) and (max-width: 1024px) { .body{ width:800px; } }

No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.

Important Mobile Technologies Links