最新版Chrome中的css无效

时间:2015-12-16 17:06:46

标签: html css

我正在编写网站并尝试制作背景图片,但图片无法显示。任何想法都会有所帮助

nav{
background-image: url("/top-Bar.png") 0 0 no-repeat;
height: 100%;
width: 100%;
}

2 个答案:

答案 0 :(得分:4)

当您使用background-image

时,您正在使用background
nav{
  background: url("/top-Bar.png") 0 0 no-repeat;
  height: 100%;
  width: 100%;
}

编辑:以上假设您的图像路径当然是正确的。

答案 1 :(得分:0)

除了samuidavid的回答......你的<nav>没有身高。以像素为单位指定或将<nav>放在具有高度的<div>内。请参阅fiddle

div {
  height: 400px;
}

nav {
  background: url("http://animalpetdoctor.homestead.com/acat1.jpg") 0 0 no-repeat;
  height: 100%;
  width: 100%;
}
相关问题