Media Queries: Screen > 1024

2019-02-09 22:14发布

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.

I did this

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

}

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

3条回答
可以哭但决不认输i
2楼-- · 2019-02-09 22:18

Try this:

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


@media only screen and (max-width : 1024px) {
    .classname {
        /* other styles here */
    }
}
查看更多
兄弟一词,经得起流年.
3楼-- · 2019-02-09 22:18
@media all and (min-width: 1024px) {
  #css {
    foo : bar;
  }
}
查看更多
Viruses.
4楼-- · 2019-02-09 22:39

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

@media screen and (min-width: 1024px) {
    /* Styles go here */
    #layout {
        width: 90%;
    }
}
查看更多
登录 后发表回答