当前位置:Gxlcms > html代码 > 求教!div中的背景图片无法显示。_html/css_WEB-ITnose

求教!div中的背景图片无法显示。_html/css_WEB-ITnose

时间:2021-07-01 10:21:17 帮助过:15人阅读

这是我的html语言:




这是我的css语言:

div,form,img,ul,ol,li,dl,dt,dd{margin:0;padding:0;border:0;text-align:left;}
li{list-style-type:none;}
ul,li {list-style:none;}
a {color:#333; text-decoration:none;}

#header{width:900px;height:100px;margin:0px auto;clear:both;}
#banner{width:900px;height:25px;margin:0px auto;clear:both;background:url(D:\网站建立\HTML程序\诗词库\图片\banner.jpg)repeat;}
#banner li{width:225px;line-height:25px;text-align:center;float:left;background:url(D:\网站建立\HTML程序\诗词库\图片\banner2.jpg)repeat;}
#banner li.last{background:none;}
#banner li a{font-size:19px;color:blue;}
#banner li a:hover{font-weight:bold;color:#ffff00;text-decoration:none;}




目的就是要实现一个导航栏的功能,但现在除了背景图无法显示完都可以了。而且两个背景图的尺寸和我div的设置尺寸一模一样啊。求大神们看看我代码哪里出了问题。


回复讨论(解决方案)

Not allowed to load local resource
放服务器上,如果是本地的也可以换个浏览器测

路径不对
如果不是站点下的图片,用file:///开头

file:///D|/网站建立/HTML程序/诗词库/图片/banner.jpg

如果是站点下的图,用虚拟路径,不要写盘符

人气教程排行