我的网站上的标题图片有问题 - 它的大小为 1920 x 410 像素。
我不想显示整个图像,但不知何故,它四面八方的部分都被裁剪了。
这是我的 CSS:
#banner {
background: url('img/kontakt-header-novi.jpg');
background-position: center;
background-size: cover;
height: 410px;
}
和 HTML:
<div id="banner"></div>
如何解决?
封面是以全尺寸显示...包含始终显示所有图像
#banner {
background: url('http://via.placeholder.com/350x150');
background-position: center;
background-size: contain;
height: 410px;
background-repeat: no-repeat;
}
<div id="banner"></div>
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句