Suppose that I have a div
element and I would like the opacity of the background color element (not the text) to be gradually increased in a given amount of time (not immediate change), where the initial opacity is 0, and the ending opacity to be either 1 or a smaller decimal like 0.7.
For instance, I would like the background-color of a div
to be from rgba(90, 129, 229, 0) to rgba(90, 129, 229, 3) in 3 seconds.
I tried making a the opacity value @keyframes, but I would like it to target only the background color.
I would like a solution in vanilla HTML and CSS. Thanks. Please let me know if the explanation of the question is too simple and more information is needed.