Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/74.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 无法在引导中为英雄单位设置背景图像_Jquery_Css_Twitter Bootstrap - Fatal编程技术网

Jquery 无法在引导中为英雄单位设置背景图像

Jquery 无法在引导中为英雄单位设置背景图像,jquery,css,twitter-bootstrap,Jquery,Css,Twitter Bootstrap,无论我如何尝试在引导中为英雄单位设置背景图像,结果都是空白, 它显示身体的颜色,我也试着设置z-索引值,但它不起作用,这是我第一次设计网页,我完全没有主意了 这是代码,plz指南 .hero-unit { padding: 60px; margin-bottom: 30px; font-size: 18px; font-weight: 200; line-height: 30px; background-image:url('img/tech9.jpg'); posi

无论我如何尝试在引导中为英雄单位设置背景图像,结果都是空白, 它显示身体的颜色,我也试着设置z-索引值,但它不起作用,这是我第一次设计网页,我完全没有主意了

这是代码,plz指南

.hero-unit {
  padding: 60px;
  margin-bottom: 30px;
  font-size: 18px;
  font-weight: 200;
  line-height: 30px;
  background-image:url('img/tech9.jpg');
  position:relative;
  z-index:1;
  -webkit-border-radius: 6px;
    -moz-border-radius: 6px;
        border-radius: 6px; 
}

是的,我已经仔细检查了我的图像路径和文件名……

如果您的css位于外部文件(如style.css)中,并且您的图像不在同一文件夹中

像这样

css/
style.css
img/
tech9.jpg
index.html
css/
style.css
img/
tech9.jpg
index.html
那么你的图片url应该是

background-image:url('../img/tech9.jpg'); 背景图片:url('../img/tech9.jpg'); 您能否检查浏览器的网络控制台选项卡,并确保
img/tech9.jpg
实际加载正确?