Meta viewport tag and css media queries

Mobile Technologies Mobile Computing 3 years ago

3.92K 1 0 0 0

_x000D_ _x000D_ I have a problem with CSS media queries using together with meta viewport tag. I am making iPad webapp that will work inside standalone view on home screen. This is the CSS: .header_portrait { position: relative; top: 0px; left: 0px; background: #ccc; width: 1536px; height: 219px; } .header_landscape { position: relative; top: 0px; left: 0px; background: #fff; width: 1536px; height: 219px; } @media only screen and (max-device-width: 1024px) and (orientation:portrait) { .header_landscape { display: none; } } @media only screen and (max-device-width: 1024px) and (orientation:landscape) { .header_portrait { display: none; } } This is part of HTML : This is part of HTML :
If I remove meta viewport tag from head orientation detection works fine. It seems that viewport mess up max-device-width so that CSS media query doesn't detect it as it should. Any help is greatly appreciated :)

User submissions are the sole responsibility of contributors, with TuteeHUB disclaiming liability for accuracy, copyrights, or consequences of use; content is for informational purposes only and not professional advice.

Answers (1)

Post Answer
profilepic.png
manpreet Tuteehub forum best answer Best Answer 3 years ago
_x000D_ (Answered in comments or edits. See Question with no answers, but issue solved in the comments (or extended in chat) ) The OP wrote: I have solved this! Just replace: With: It works well for now and in iPad 3 I must test it in iPad 1 and 2...
0 views
0 shares

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.

Similar Forum


Q

Would Firebase be a good choice as a server for the Flutter mobile game I'm creating?

_x000D_ _x000D_ I am building a turn-based Flutter game. Would Firebase be a good choice as a server...
Q

Implement Bottom Navigation activity along with a VerticalViewPager with nested Cardview in Android...

_x000D_ _x000D_ I want to develop an Android App which will have a Bottom Navigation Bar and above i...
Q

(JS) For , determine if the device offers or not to capture a photo from the camera

_x000D_ _x000D_ When uploading a file, I need to give the user the possibility: upload the file fr...

Important Mobile Technologies Links