我工作的一些自定义的WordPress主题,在我的style.css我有两个地方我使用的背景图片,在这里它工作正常:为什么background-image在一个地方工作,但在另一个地方不工作?
#gallery {
background-attachment: fixed;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
background-image: url("img/gallery.jpg");
min-height: 100vh;
padding-top: 50px;
color: white;
text-align: center;
}
,但在这里不显示:
#pageHeader {
background-image: url("img/pageHeader.jpg");
overflow: auto;
overflow-y: hidden;
text-align: center;
padding-top: 30px;
padding-bottom: 30px;
}
其次是针对page.php文件,其他功能如文本对齐工作正常,只有问题是与背景图像。当然,两个jpgs都在同一个位置。
我检查了,它给“无法加载图片”
它被另一种风格所覆盖吗?你使用过浏览器的检查员了吗?打F12。 – LeonardChallis
尝试使用类似'url(“../ img/pageHeader.jpg”)'的URL。和/或重新检查图像的名称和它的位置。 –
不起作用,Firefox检查员说“无法加载图像”,但其括号中的加载 – egzaell