Skip to content
Advertisement

transition-duration not working when used with Boostrap .form-control

I’m developing a Sign In registration box in HTML, CSS, and JS using Bootstrap.

I made a simple animation where, on the click of the button, the middle input field slide on the left with the input fields on top and bottom goes down and up, like a closing and opening effect.

With plain HTML and no Bootstrap classes imported everything works fine. As soon as I add the class form-control to the input field the transition-duration: 0.5s; in the CSS code seems not working anymore.

My code

JavaScript
JavaScript
JavaScript

The live code is available also here https://codepen.io/nicocaldo/pen/pobvGVV

Am I missing something?

Advertisement

Answer

You set a duration, but you didn’t tell it what to animate. So, you need to add transition-property: transform; too. To animate everything you set, you could set it to all, but only transform is needed so that works. Or for short, you could replace the entire thing with just transition: all 0.5s;. (https://codepen.io/phpdude/pen/MWeYLZP)

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement