CSS 背景图像不显示 [英] CSS Background Image Not Displaying

查看:48
本文介绍了CSS 背景图像不显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 HTML 文件,其中包含一个名为 img 的子目录,其中包含一个名为 debut_dark.png 的图像.在我的 CSS 文件中,我有:

I have an HTML file with a subdirectory called img with an image called debut_dark.png. In my CSS file, I have:

body { 
    background: url(/img/debut_dark.png) repeat 0 0;
}

HTML 文件具有 body 标记,并且确实适当地包含了 CSS 文件.我确信 CSS 文件已正确包含,因为其他所有内容均已正确格式化.

The HTML file has the body tag and does include the CSS file appropriately. I know for sure the CSS file is included properly as everything else is formatted properly.

背景图像未显示,我只看到白色背景.任何想法如何解决这个问题,甚至如何调试它?

The background image is not getting displayed, I am only seeing a white background. Any ideas how to fix this, or even how to debug it?

推荐答案

根据你的CSS文件路径,我假设它和你的HTML页面在同一个目录下,你必须改变url 如下:

According to your CSS file path, I will suppose it is at the same directory with your HTML page, you have to change the url as follows:

body { background: url(img/debut_dark.png) repeat 0 0; }

这篇关于CSS 背景图像不显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆