CSS Properties: How to color property is animatable?
Solution:
HTML Code:
Explanation:
- This HTML document demonstrates how to create an animatable color property using CSS animations.
- The CSS style block defines rules for the div with the id "mydiv".
- The div with the id "mydiv" has a magenta border with a thickness of 1 pixel, a width of 200 pixels, and a text color of purple (#CC64FF).
- An animation named "mymove" is applied to the div with the id "mydiv" for 5 seconds, repeating infinitely.
- The CSS animation "mymove" is defined using keyframes, specifying that at the halfway point (50%), the color of the div with the id "mydiv" changes to a shade of blue (#3334CC).
- The HTML body contains an h1 element with the text "w3resource Tutorial" and a paragraph element describing CSS.
- During the animation, the text color of the div with the id "mydiv" changes from purple to blue at the halfway point, creating an animatable color effect.
Live Demo:
See the solution in the browser
Supported browser
![]() |
![]() |
![]() |
![]() |
![]() |
Yes | Yes | Yes | Yes | Yes |
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics