简体   繁体   中英

issue with media queries css

I have a problem with media queries in my css, i want to apply a style when the screen size is 900px, but that style works until the screen size is 810px.

this is my viewport:

<meta name="viewport" content="width=device-width,initial-scale=1.0, user-scalable=no">

and this is my css:

@media all and (max-width: 900px){
    .form{display:none;}
}

my html is only this

<div class="form"><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p></div>

I couldn't find a solution about this problem. Thanks for your help :).

我遇到了这个问题,只是我不小心将浏览器屏幕缩小了。

Try any of the below and let me know if it's work for you or not...

@media screen and (max-width: 900px){
        .form{display:none;}
    }
    *************
    @media only screen and (max-width: 900px){
        .form{display:none;}
    }

Also change the viewport line to this:

<meta name="viewport" content="width=device-width,initial-scale=1.0, user-scalable=yes">

OR

<meta name="viewport" content="width=device-width, initial-scale=1.0" />

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM