I am trying to make another difficult to me test about CSS.
What I want is to make some text scrolling and when it is hovering over a div it will revert it’s color.
For example from dark, that it can be black on a white background, to something more lighter when it is hovering a darker background.
Here is what I have made as a code, and from my search I think I need these two properties:
mix-blend-mode: difference;
filter: invert(1);
If you could open the codepen link in a tab it works better I think.
Min-blend mode only works on the background of a parent of the element in question.
The mix-blend-modeCSS property sets how an element’s content should blend with the content of the element’s parent and the element’s background.
You are placing a fixed positioned background underneath the text therefore the text really has no background to interact with. (At least that’s how I interpret the specs ;))
As an example you can see that if you had some background-color to the parent then you would get the difference.
or:
Note that you cannot have black text because the difference would be white which would be invisible over the page background.
I’m not 100% sure of your use case but you will need to make it work with the constraints mentioned above.
Basically what I am trying to do, is to have black text over white background, and when this text is scrolling up and meets another div - which it will have an image as a background not just plain color - it will change the color to “difference” according to the image background.
Maybe this is not something that can be done though?
Is it possible when the mouse is outside of the animation area, to scroll the text with the mouse wheel?
Will this need to create javascript code, or it can be done with the normal way somehow?