I am facing a very strange issue with Nexus 7 regarding CSS media queries. The media query runs fine on orientation change, but if we keep the device in landscape mode and keep it idle for some time and then on orientation change the viewport takes the styling of the landscape mode other than the portrait mode styling.
Here is the code that I have written
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="css/css.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div></div>
</body>
</html>
And in the css file the styling is as below.
div {height: 500px; width: 500px;}
@media only screen and (min-width:480px) {
div {background: red;}
}
@media only screen and (min-width:768px) {
div {background: green;}
}
For other devices like Ipad, Iphone, S3 etc the media queries runs fine even if these devices are kept idle and then on orientation it takes the respective viewport styling, but on Nexus 7 the div colour remains green when the orientation changes from landscape to portrait view after the device is kept idle for some time.
Please help me out with this situation.