Имеется первый блок с bg-изображение. Слоем выше находится следующий-второй блок, но с уже bg в виде #fff, т.е. первый блок с фоном #fff перекрывает собой второй блок с bg-изображение.
Имеется-ли возможно вырезать часть фона второго блока так, чтобы мы через это отверстие увидели изображение первого блока?
Скрин-пример:
Можно через clip-path, в статье Аны Тюдор описано более подробно.
.wrapper {
width: 610px;
height: 565px;
position: relative;
}
.wrapper > div {
width: inherit;
height: inherit;
}
.first-layer {
background: url(https://i2.wp.com/digital-photography-school.com/wp-content/uploads/flickr/5661878892_15fba42846_o.jpg?resize=610%2C565&ssl=1);
position: absolute;
}
.second-layer {
position: absolute;
background: #fff;
clip-path: polygon(
/* points of the outer triangle going counterclockwise */
285px 150px, 83px 33px, 83px 267px,
/* return to the first point of the outer triangle */
285px 150px,
/* points of the inner triangle going clockwise */
258px 150px, 96px 244px, 96px 56px,
/* return to the first point of the inner triangle */
258px 150px
);
}
<div class="wrapper">
<div class="first-layer"></div>
<div class="second-layer"></div>
</div>
Нашли решение: https://www.sarasoueidan.com/blog/css-svg-clipping/
<svg>
<defs>
<clipPath id="clipping">
<polygon points="98.4999978 153.75..."/> // ваша маска
</clipPath>
</defs>
</svg>
-
.item {
clip-path: url(#clipping);
}
Сборка персонального компьютера от Artline: умный выбор для современных пользователей