我正在尝试从CSS显示我的徽标,但它不会显示。

当我检查元素时,它表明图像在那里,但不会出现在网页上。





#logo_image {
  margin-top: 13px;
  float: left;
  background: url(images/logo_color.png) no-repeat;
  padding: 8px 16px 8px 16px;
}

<a href="index.html" id="logo_terra"></a>

最佳答案

您的ID错误,只需更改为#logo_terra,再加上widthheight,否则您的大小将为padding



#logo_terra {
  margin-top: 13px;
  float: left;
  background: url(//lorempixel.com/100/100) no-repeat;
  padding: 8px 16px;
  width: 100px;
  height: 100px
}

<a href="index.html" id="logo_terra"></a>

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

10-09 06:42
查看更多