简体   繁体   English

CSS 媒体查询读取错误宽度

[英]CSS Media queries reading wrong width

I'm trying to set some styles on a page with basic CSS and when I refresh the page to see expected results, all I can see that chrome uses styles from another query which it shouldn't do, when I browse from my phone I see styles from @media (max-width:1220px) and (min-width:965px) when it should show styles from @media (max-width: 767px) .我正在尝试在具有基本 CSS 的页面上设置一些 styles 并且当我刷新页面以查看预期结果时,我只能看到 chrome 使用 styles 从我的手机浏览另一个查询时应该这样做当它应该显示来自@media (max-width: 767px) styles 时,请参阅来自@media (max-width:1220px) and (min-width:965px)的 styles 。 Anyone had this problem before?以前有人遇到过这个问题吗?

@@media (min-width:1221px) {

    //some style
}

/* Tablets and very small desktop screens (if some) */
@@media (max-width:1220px) and (min-width:965px) {

    //some style
}

/* Tablets and very small desktop screens (if some) */
@@media (max-width:964px) and (min-width:768px) {

    //some style
}


@@media (max-width: 767px){

    //some style
}

Try this, remove @@media and put one @media试试这个,删除@@media 并放一个@media

@media (min-width:1221px) {

    //some style
}

/* Tablets and very small desktop screens (if some) */
@media (max-width:1220px) and (min-width:965px) {

    //some style
}

/* Tablets and very small desktop screens (if some) */
@media (max-width:964px) and (min-width:768px) {

    //some style
}


@media (max-width: 767px){

    //some style
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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