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:
If you could open the codepen link in a tab it works better I think.
Although I have not make it working until now.
Min-blend mode only works on the background of a parent of the element in question.
mix-blend-mode CSS 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.
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.
Ok I see your point.
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?
You can use an image in my example to the same effect.
However, I’d need to see your full use case to work out if what you actually want is possible or not.
Yes that’s really awesome!! Thanks!
The only thing that bothers me, is that the font is getting bolder, is there any way to avoid it?
It looks like its a result of the mix-blend mode. The only thing that springs to mins is perhaps to reduce the opacity a bit.
Actually adding this seems to help Chrome:
I did see an article about this sort of thing:-
Thank you so so much this seems to work.
I will check the article too, looks awesome!!!
Is it possible when the mouse is outside of the animation area, to scroll the text with the mouse wheel?
Not sure if this is what you mean exactly.
Yes it works!!!
Thank you PaulOB, I own you a beer if you ever come to Greece!!
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.