why does this code with unset
cause the animation to not work over the element, whereas
this code works perfectly well without the code: all: unset
?
(this was a nightmare to debug)
non link version:
document.getElementById("mybutton").addEventListener("click", myflashgreen);
function myflashgreen() {
document.getElementById("quizreminderarea").className += " flashgreen";
document.getElementById("quizreminder").className += " flashgreen";
setTimeout(function() {
document.getElementById("quizreminderarea").classList.remove("flashgreen");
document.getElementById("quizreminder").classList.remove("flashgreen");
}, 410);
}
#quizreminder {
all: initial;
* {
all: unset;
}
}
.flashgreen {
-webkit-animation-name: flashgreen;
-webkit-animation-duration: 0.3s;
animation-name: flashgreen;
animation-duration: 0.3s;
}
@-webkit-keyframes flashgreen {
from {
background: #48ff00;
}
to {
background: default;
}
}
@keyframes flashgreen {
from {
background: #48ff00;
}
to {
background: default;
}
}
#div {
width: 150px;
}
#quizreminder {
left: 74%;
height: 12em;
background: white;
color: black;
position: fixed;
}
#quizreminderarea {
width: 5000px;
height: 12em;
background: white;
color: black;
position: fixed;
}
<button id="mybutton">
click me
</button>
<div id="quizreminderarea"><textarea id="quizreminder" class=""></textarea></div>
removing the first css block will cause the desired result whereas leaving it will cause the textarea to block the animation completely, forcing it to the background