【问题标题】:how can i make media query work with min-with?我怎样才能使媒体查询与最小宽度一起工作?
【发布时间】:2022-11-30 17:53:59
【问题描述】:

`

@charset "UTF-8";
/* inport the basis style page */
@import url("body.css");
/* why is this not working???? */
/* import alternative style 500px*/
@media (min-width: 500px){
@import url("screen_layout_small.css");
}

`

文件:screen_layout_small.css `

@charset "UTF-8";

body {
    background-color: red;
}

`

当 url("screen_layout_small.css") 不在@media 中时它会工作(当它不在响应式命令中时工作??)

加载 css 文件 screen_layout_small.css 当大小最小为 500 或更大时加载 screen_layout_small.css

顺便说一句,我使用 min-with 还是 max-with 并不重要。 该文件不会在@media 中加载!!!

【问题讨论】:

标签: css url import media


【解决方案1】:

我认为您使用了错误的语法。它应该是:

@import url|string list-of-mediaqueries;

所以在你的情况下它应该是:

@import "screen_layout_small.css" screen and (min-width: 500px);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-06-04
    • 1970-01-01
    • 2022-11-24
    • 1970-01-01
    • 2021-12-29
    • 1970-01-01
    • 2011-12-05
    • 2019-11-12
    相关资源
    最近更新 更多