The following web page displays correctly on desktop but I can't figure out why it's not working on a android phone(the color of the text is always blue):
<html>
<head>
<style type="text/css">
@media screen { body { color: blue; } }
@media handheld { body { color: red; } }
</style>
</head>
<body>
This is a test!
</body>
</html>
Tested on:
On all the mobile browsers the option to display web page as on computer screen has been disabled. The online web pages that use media queries work correctly.
I've also tried only screen/not screen pair and it still does not work.
Thanks!
Try by targeting the view port size
@media screen { body { color: blue; } }
@media only screen
and (max-width : 420px) {
/* Styles */
body { color: red; }
}
Modify the "max-width" according your targeted device view port
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.