如何按条件通过媒体查询导入css文件

时间:2013-04-16 13:27:17

标签: css css3 media-queries

在我的外部css文件中,我正在尝试使用导入加载css ...但是我无法通过有条件的方式导入css文件...

有没有办法这样做?

我的尝试:

body {
    background: url(../images/1024/css/bodyBg.jpg);
}
body > section > header{
    background: url(../images/1024/css/headerBg.jpg) top repeat-x;
    height: 93px;
    border: solid black;
    border-width: 5px 0;
}


@media screen and (max-width: 768px){
    @import url(../styles/sedms.css); // i am not able to import... 
}

1 个答案:

答案 0 :(得分:1)

格式正确

@import url(../styles/sedms.css) (max-width:768px);

见这里:http://philarcher.org/diary/2011/importrules/