我有一个带有一些文本的简单容器。我试图将不重复的背景图像放在文本后面的中心,但我的代码不起作用。这是一个引用:http://www.danielhopwood.com/#about
我的代码是这样的文本容器:
.main-descr {
background: url(img/cnp_bg.png) no-repeat center;
}
但是图片(cnp3.png)没有出现,点击这里:http://www.mysecretathens.gr/CNP/about.html
为什么会这样,我该怎么办?使用 background-image
没有区别..
最佳答案
它正在为该图像获取 404。 url 应该与 CSS 相关。
background: url(../img/cnp3.png);
注意../
那么你应该能够做到:
background: url(../img/cnp3.png) no-repeat center center;
关于css - 文本 DIV 中的背景图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16245159/