CSS背景图像被切断

时间:2017-02-07 11:47:30

标签: css

我已经看过其他类似的帖子,似乎无法找到答案。

查看盾牌背景图片。它在顶部和底部略微切断......我尝试过很多东西,但我无法正常显示。

以下是网站http://revivedlife.com

这里是背景图片的CSS:

.hentry h2 {
    background: url(images/post_element.png) no-repeat 0 -4px;
    display: inline-block;
}

2 个答案:

答案 0 :(得分:0)

你有没有尝试过背景:封面;

我认为以下代码可以帮助您:)

.hentry h2 {
    background-attachment: fixed;
    background-image: url("http://revivedlife.com/wp-content/uploads/2016/03/bg_body.jpg");
    background-position: left top;
    background-repeat: no-repeat;
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover;
}

答案 1 :(得分:0)

尝试用以下内容替换现有的CSS:

.hentry h2 { 
  background: url(LOCATION HERE) no-repeat center center fixed; 
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
}

这将确保背景图像看起来正确,即使在旧浏览器上也是如此。

相关问题