css - 背景图像未显示在 css 中

标签 css background

我浏览了该站点,并尝试了其他人所说的多种方法,但我的图像仍然无法正常工作,文本颜色工作正常,因此在使用外部 CSS 时似乎没有错误。这是我的CSS。我用过 https://jigsaw.w3.org/css-validator/验证文本,它似乎是正确的,但由于某种原因它没有出现。

      body { 
  background-image:url('images/sg.jpg');
  color:#BFB083;
  }
  h1{ color:#BFB083;}
  a{color: #705438}

  #wrapper { width: 1000px;
              margin-left: auto;
              margin-right: auto;
              }

谢谢

最佳答案

在后台url的开头添加斜杠:

background-image:url('/images/sg.jpg');

关于css - 背景图像未显示在 css 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33045628/

相关文章:

css - 媒体查询适用于桌面浏览器,但不适用于移动设备

html - 将背景图像带到前台。可能与否?

安卓背景动画滞后游戏

android - Android中的后台传感器数据收集器

html - 在内联 li 中链接 href 背景大小

html - 在不同的页面显示不同的文本框宽度

php - 限制连续图像数量?

Javascript 菜单不工作 Firefox

javascript - 未捕获的类型错误 : Cannot call method 'menuAim' of null

html - 如何在 div "container"(950px) 上填充 div 的背景色