.jumbotron {
margin-bottom: 0px;
background-image: url(../img/desktop-urania.jpg);
min-height: 600px;
background-attachment: fixed;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
这是HTML中的工作CSS,但我试图将HTML转换为WordPress,同时转换我在function.php中链接我的样式表 (function urania_script_enqueue() { wp_enqueue_style('customstyle', get_template_directory_uri() . '/css/urania.css', array( '$handle', '$src', '$deps', '$ver', '$media'), '1.0.0', 'all');)
但是图片没有加载......
主题名称URANIA :: - > Css-> urania.css(样式表)主题名称URANIA :: - > img - > desktop-urania.jpg(图片)
请帮忙
2 回答
如果图像颜色模式为CMYK,请检查图像颜色模式,然后在IE-8上不显示,需要将颜色模式更改为RGB .
如果您的图像颜色模式是正确的,那么最好是您可以共享实际的站点URL,以便我们可以正确地看到站点的结构 .
PHP不能在css文件中工作,但你可以使用内联的wordpress函数 . 你可以只用css . 由于我的css(在sass处理之后)最终在主题根目录中的一个文件中,我不得不改变我的文件路径 .
以下stackoverflow答案解决了我的问题 . CSS background images in WordPress
尝试仔细检查文件路径或遵循wp约定并将CSS放在根目录中的styles.css中 . 见
get_template_directory_uri()
. 也许wordpress喜欢quoatation mark中的路径?