Created
January 7, 2019 14:28
-
-
Save delphinpro/4ecc8d40068fed3f7632b1522ada8028 to your computer and use it in GitHub Desktop.
Наложение цвета в CSS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="block"> | |
<img class="img" src="image.png" alt=""> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.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