CSS Properties: How bottom property is animatable?
Solution:
HTML Code:
Explanation:
- The position: absolute; CSS property sets the positioning method of the element to absolute, positioning it relative to its nearest positioned ancestor.
- The width: 200px; CSS property sets the width of the element to 200 pixels.
- The height: 100px; CSS property sets the height of the element to 100 pixels.
- The border: 3px solid #FF0000; CSS property sets the border properties of the element to a 3-pixel wide solid red border.
- The background-color: #46C3FF; CSS property sets the background color of the element to light blue (#46C3FF).
- The bottom: 20px; CSS property sets the distance between the bottom edge of the element and its nearest positioned ancestor to 20 pixels.
- The @keyframes rule defines a keyframe animation named "mymove" that changes the value of the bottom property to 300 pixels at the midpoint of the animation.
- The animation is applied to the #xyzdiv element, causing its bottom position to change over time.
Live Demo:
See the solution in the browser
Supported browser
![]() |
![]() |
![]() |
![]() |
![]() |
Yes | Yes | Yes | Yes | No |
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.