CSS背景图片未显示 [英] CSS Background Image Not Displaying

查看:146
本文介绍了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天全站免登陆