CSS Properties: How to set the width of the bottom border animatable?
Solution:
HTML Code:
Explanation:
- This HTML document demonstrates how to animate the width of the bottom border of a <div> element.
- The CSS style block targets the div element with the id "div".
- The width and height of the div are set to 150px and 100px respectively.
- The border is set to 1px solid red.
- An animation named "mymove" is defined using keyframes.
- In the keyframes, the border-bottom-width property is specified to change to 50px at the 50% mark of the animation.
- As a result, the bottom border width of the div element will be animated from its initial width to 50px over a duration of 5 seconds, and the animation will repeat infinitely.
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.
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics