无法在bootstrap中将背景图像设置为hero-unit

时间:2013-09-24 05:18:25

标签: jquery css twitter-bootstrap

我怎么试着在bootstrap中将背景图像设置为英雄单位,它只是变成空白, 它显示了车身颜色,我也尝试设置z-index值,它只是不起作用,这是我第一次设计一个网页,我全都没有想法

这是代码,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; 
}

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

1 个答案:

答案 0 :(得分:1)

如果您的css位于style.css之类的外部文件中,并且您的图片不在同一个文件夹中

像这样

css/
  style.css
img/
  tech9.jpg
index.html

然后您的图片网址应该像



    background-image:url('../img/tech9.jpg');