I wonder if it is possible to apply a CSS style when one of my HTML displayed value changes. I'd like to apply a "shake" effect when the values are updated.
Is there a CSS selector for that, something like following ?
.button:change {
transform: translateY(-10px);
}
CodePudding user response:
No. CSS pseudo-classes key off states.
For example, :focus
applies while an element has the focus.
There are none which target elements which have just changed from one state to another, and "has different content" isn't a state that is supported.
You'll need to use a DOM event and JavaScript for this.