CSS 媒体查询:屏幕 > 1024

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11975758/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 04:49:15  来源:igfitidea点击:

Media Queries: Screen > 1024

cssmedia-queries

提问by m4g4bu

I'm trying to apply media queries in a site but my knownledge is not deep in this topic, so basically I want to apply a specific style to a tag when the detected screen is greater than 1024*768.

我正在尝试在站点中应用媒体查询,但我对这个主题的了解并不深入,所以基本上我想在检测到的屏幕大于 1024*768 时将特定样式应用于标签。

I did this

我做了这个

@media screen and ( device-width: 1024px ) {

}

but the I've to identify when the resolution is greater than 1024

但我必须确定分辨率何时大于 1024

回答by Mike Brant

Try this:

尝试这个:

@media only screen and (min-width : 1025px) {
    .classname {
        /* styles here */
    }
}


@media only screen and (max-width : 1024px) {
    .classname {
        /* other styles here */
    }
}

回答by Stieffers

Use a standard media screen query. The query will trigger the style changes once the width is 1024px or greater.

使用标准媒体屏幕查询。一旦宽度为 1024px 或更大,查询将触发样式更改。

@media screen and (min-width: 1024px) {
    /* Styles go here */
    #layout {
        width: 90%;
    }
}

回答by Ties

@media all and (min-width: 1024px) {
  #css {
    foo : bar;
  }
}

回答by user3690329

@media (min-width: 1024px) and (max-width: 1920px) {

html { background: red; } }

html { 背景:红色;} }