Как сделать - Вырезать текст
Узнайте, как создать адаптивный вырезанный/заглушенный текст с помощью CSS.
Вырезанный текст (или выбивной текст) — это прозрачный текст, который вырезан поверх фонового изображения:
ПРИРОДА
Примечание. Этот пример не работает в Internet Explorer или Edge.
Как создать вырезанный текст
Шаг 1) Добавьте HTML:
Пример
<div class="image-container">
<div class="text">NATURE</div>
</div>
Шаг 2) Добавьте CSS:
Свойство mix-blend-mode
позволяет добавить вырезанный текст к изображению. Однако он не поддерживается в IE или Edge:
Пример
.image-container {
background-image: url("img_nature.jpg");
/* The image used - important! */
background-size: cover;
position: relative; /* Needed to position
the cutout text in the middle of the image */
height: 300px; /* Some
height */
}
.text {
background-color: white;
color: black;
font-size: 10vw;
/* Responsive font size */
font-weight: bold;
margin: 0 auto; /* Center the text container */
padding: 10px;
width: 50%;
text-align: center; /* Center text */
position: absolute; /* Position text */
top: 50%; /* Position text in the middle */
left: 50%; /* Position
text in the middle */
transform: translate(-50%, -50%); /* Position text in the middle */
mix-blend-mode: screen;
/* This makes the cutout text possible */
}
Если вам нужен черный контейнерный текст, измените режим смешивания на «умножение» и цвет фона на черный, а цвет на белый:
Пример
.text {
background-color: black;
color: white;
mix-blend-mode:
multiply;
....
}