尝试对导入的css文件使用相对URL。因此,请先尝试删除/
从每个导入URL:
@import url(\'styles/forms.css\');
@import url(\'styles/tables.css\');
@import url(\'styles/homepage.css\');
@import url(\'styles/reset.css\');
@import url(\'styles/stimenu.css\');
@import url(\'styles/layout.css\');
@import url(\'styles/demo.css\');
还要注意使用
@import
指令是错误的做法,强烈建议不要使用。使用
link
而不是它。为什么?阅读此处:
@import vs link.
因此,在您的中,我强烈建议您这样编写代码:
add_action( \'wp_enqueue_scripts\', \'wpse8170_enqueue_scripts\' );
function wpse8170_enqueue_scripts() {
$baseurl = get_template_directory_uri(); // if you write plugin use plugins_url();
wp_enqueue_style( \'wpse8170-forms\', "{$baseurl}/styles/forms.css" );
wp_enqueue_style( \'wpse8170-tables\', "{$baseurl}/styles/tables.css" );
wp_enqueue_style( \'wpse8170-homepage\', "{$baseurl}/styles/homepage.css" );
wp_enqueue_style( \'wpse8170-reset\', "{$baseurl}/styles/reset.css" );
wp_enqueue_style( \'wpse8170-stimenu\', "{$baseurl}/styles/stimenu.css" );
wp_enqueue_style( \'wpse8170-layout\', "{$baseurl}/styles/layout.css" );
wp_enqueue_style( \'wpse8170-demo\', "{$baseurl}/styles/demo.css" );
wp_enqueue_style( \'wpse8170-style\', "{$baseurl}/style.css", array( \'wpse8170-forms\', \'wpse8170-tables\', \'wpse8170-homepage\', \'wpse8170-reset\', \'wpse8170-stimenu\', \'wpse8170-layout\', \'wpse8170-demo\' ) );
}