为了得到结果,你需要改变
background-origin: padding-box;
到
background-origin: content-box;
.
这是因为背景的位置
相对的
当你使用填充框时
背景来源:填充框;
,为了尊重填充,需要将其相对于内容框放置。
html, body {
padding: 0;
}
.hero_image {
min-height: calc(100vh - 72px);
background-color: rgb(0, 97, 111);
box-sizing: border-box;
padding: 72px;
background-origin: content-box;
background-image: url("https://s7.postimg.cc/6vtowr3u3/salters_hill_old_logo.jpg");
background-position: center center;
background-repeat: no-repeat;
background-size: contain;
}
<div class="hero_image"></div>