I have used the media queries for different width.I have used 3 Style sheets for mobile, tab and desktop views as follows:- For Mobile View:-
@media only screen and (min-width : 120px) and (max-width : 640px) { }
For Tab View:-
@media only screen and (min-width : 640px)and (max-width : 980px){ }
For Desktop View:-
@media only screen and (min-width : 980px) { }
When I am re sizing my browser then it is showing the adaptive view but while checking in mobile device the web page is still showing the browser view.
The responsive view is also not adaptive while checking in the Device Emulator functionality of the google chrome browser.
However the side menu bar used for mobile view is still visible in the mobile view as expected but the remaining site is not adapting the width and height accordingly.
Can anyone explain the issue and reason behind it.
PS : I am restricted to media queries not able to use Bootstrap or any other framework for making my site responsive.
Here we go. As per your media queries, browser is not sure what layout should be adapted because you have defined the same width as break point. What you need to do is define media queries like this.
For Mobile View:-
@media only screen and (min-width : 120px) and (max-width : 639px) { }
For Tab View:-
@media only screen and (min-width : 640px)and (max-width : 979px){ }
For Desktop View:-
@media only screen and (min-width : 980px) { }
Hope this help you.! Do come back if still having issue.!
only screen and
and leave it like @media (min-width : ...
these attributes is not required. screen and
just remove the only
keyword. From specs : The keyword 'only' can also be used to hide style sheets from older user agents. User agents must process media queries starting with 'only' as if the 'only' keyword was not present.
PS.: You don't have to specify min-width
for the smallest screen in the list of @media
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.