Make an animation in CSS which will stretch the height to 0% but keeping the centre, and…
- User
Make an animation in CSS which will stretch the height to 0% but keeping the centre, and then going back to 100% and having a bounce end.
- Assistant
Sure! Here's an example of CSS animation that will stretch the height to 0% while keeping the center, and then bounce back to 100%:
HTML:
html<div class="box"></div>CSS:
css.box { position: relative; width: 200px; height: 200px; background-color: #f9c2ff; margin: 100px auto; animation: stretch 2s ease-in-out; } @keyframes stretch { 0%, 100% { height: 100%; } 50% { height: 0%; } 70% { height: 30%; } 90% { height: 70%; } }In this example, we create a element with the class name "box". The animation will be applied to this element.