我的 HTML 中有这个,除了背景图像外,一切正常:'images/Header.jpg'; 相反,我在标题中看到了灰色,但没有看到图像。我尝试删除灰色,但仍然看不到图像...
#outerWrapper #header {
border-bottom: solid 1px #628152;
font-size: 18px;
font-weight: bold;
line-height: 15px;
height: 115px;
background-color: Grey;
background-image: url('images/Header.jpg');
我怎样才能使这项工作..请帮助..谢谢
最佳答案
你的CSS文件路径和图片路径是什么?
您必须考虑到,在 CSS 中使用 url()
时,路径是相对于 CSS 文件的,而不是相对于请求的页面。
假设您有以下文件:
/website/index.html
/website/templates/main.css
/website/images/header.jpg
CSS 必须是:
.style{background-image:url(../images/header.jpg);} /* Noticed "../"? */
关于asp.net - 背景图像不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4326813/