我正在尝试根据媒体查询导入样式,但不会触发导入如果我将样式直接放在媒体查询中,它们将呈现到页面。
这是指向实时站点http://update.techbasics.ca的链接
这是我的 style.css 与媒体查询和导入
如果这有助于调试,我正在使用 wordpress。
@import url('base.css');
/******************************************************************
Site Name: Tech Basics
Author: Anders Kitson
Stylesheet: Main Stylesheet
Here's where the magic happens. Here, you'll see we are calling in
the separate media queries. The base mobile goes outside any query
and is called at the beginning, after that we call the rest
of the styles inside media queries.
******************************************************************/
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box; }
/*****************************************************************
BASE CSS
*****************************************************************/
/*****************************************************************
MEDIA QUERIES
*****************************************************************/
@media only screen and (min-width: 480px) {
@import url('min480.css');
}
@media only screen and (min-width: 600px) {
@import url('min600.css');
}
@media only screen and (min-width: 768px) {
body {
background: purple; } }
@media only screen and (min-width: 992px) {
body {
background: orange; } }
@media only screen and (min-width: 1382px) {
body {
background: url("../img/noisy_grid.png"); } }
/* iPhone 4 ----------- */
@media only screen and (-webkit-min-device-pixel-ratio : 1.5), only screen and (min-device-pixel-ratio : 1.5) {
@import url('base.css');
}
这是 min600.css (与 style.css 文件位于同一目录中)
header {
text-align: left; }
body{
background: green;
}