so I have this code, and I’m wondering if it can show the original color by setting mix-blend-mode: normal
or isolation: isolate
to the .element-to-ignore-blend-mode
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Ignore mix-blend-mode</title>
<style>
body {
height: 200vh; /* For scrolling */
background: white;
}
.sticky-parent {
position: sticky;
top: 0;
mix-blend-mode: difference;
background: transparent;
backdrop-filter: blur(12px);
padding: 20px;
}
.element-to-ignore-blend-mode {
isolation: isolate;
background: red;
padding: 20px;
color: black;
}
.normal-element {
background: red;
padding: 20px;
color: black;
}
</style>
</head>
<body>
<div class="sticky-parent">
<div class="element-to-ignore-blend-mode">
This element ignores mix-blend-mode: difference.
</div>
<div class="normal-element">
This element follows the mix-blend-mode: difference.
</div>
</div>
</body>
</html>
Both elements have the same background and font color, and I expect .element-to-ignore-blend-mode
to show its original color if I use either mix-blend-mode: normal
or isolation: isolate
(red and black). Does anyone know how to solve this? Or maybe an alternative way to achieve the same result?
Thank you in advance
Given is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.