我希望用背景填充父div,但不是将图像设置为div的背景属性,而是将其设置为div中的单个img元素。
换句话说,我想这样做:
div {
background-image: url('someimg.jpg');
background-size: cover;
background-repeat: no-repeat;
}
带有img元素的..but,如下所示:
<div>
<!-- Image element should cover the container on dekstops and small screens as