wordpress css精灵加载图像
我正试图在我的wordpress项目中使用这样的精灵。但我在css加载背景图像时遇到了麻烦。加载页面后,我在控制台中检查了路径,url路径很好,但我有一个404错误 我的css:wordpress css精灵加载图像,css,wordpress,sprite,Css,Wordpress,Sprite,我正试图在我的wordpress项目中使用这样的精灵。但我在css加载背景图像时遇到了麻烦。加载页面后,我在控制台中检查了路径,url路径很好,但我有一个404错误 我的css: #navlist { position: relative; } #navlist li { margin: 0; padding: 0; list-style: none; position: absolute; top: 0; width : 44px; }
#navlist {
position: relative;
}
#navlist li {
margin: 0;
padding: 0;
list-style: none;
position: absolute;
top: 0;
width : 44px;
}
#navlist li, #navlist a {
height: 44px;
display: block;
}
#facebook {
left: 0px;
background: url('/wp-content/themes/montheme/images/facebook.png') 0 0;
}
控制台中的错误消息:加载资源失败:服务器响应状态为404(未找到)
有人有解决方案吗?您不需要使用
/wp content/themes/montheme/
您可以将其称为:
background: url("images/facebook.png") 0 0;
background: url("<?php bloginfo('template_directory'); ?>/images/facebook.png") 0 0;
如果你的图像和CSS存在于你的主题中。另一种方法是将其添加到functions.php中,并将其称为:
background: url("images/facebook.png") 0 0;
background: url("<?php bloginfo('template_directory'); ?>/images/facebook.png") 0 0;
background:url(“/images/facebook.png”)0;
你能试试吗。/wp content/。。。?如果有效,请告诉我。否:/仍然无效