Skip to content

Instantly share code, notes, and snippets.

@delphinpro
Created January 7, 2019 14:28
Show Gist options
  • Save delphinpro/4ecc8d40068fed3f7632b1522ada8028 to your computer and use it in GitHub Desktop.
Save delphinpro/4ecc8d40068fed3f7632b1522ada8028 to your computer and use it in GitHub Desktop.
Наложение цвета в CSS
<div class="block">
<img class="img" src="image.png" alt="">
</div>
.block {
position: relative();
}
.img {
transition: 0.3s ease;
filter: contrast(0) grayscale(1);
:hover > & {
filter: contrast(1) grayscale(0);
}
}
@supports (mix-blend-mode: color) {
$blend-color: #b0b6bf;
.block {
background: #ffffff;
&::after {
content: '';
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
background: $blend-color;
mix-blend-mode: color;
}
&:hover::after {
opacity: 0;
mix-blend-mode: inherit;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment