I look at Code School tutorials, and there is a tutorial on animating elements using scaling and repositioning.
The video contains an animation of the label inside the form. When you focus on the input field, the label (which is inside the input field) leaves the input field and scales in size.
I'm trying to replicate - no luck.
What am I doing wrong?
https://jsfiddle.net/8tvh4x45/1/
edit: I just want to add this transform property, I can get a shortcut for the animation if I have only one animation (scale or translation), but I cannot get both to work together.
<fieldset class="form-field"> <input class="form-input" type="text" id="name"> <label class="form-label" for="name">First Name</label> </fieldset> .form-field { border: 0; } .form-input { position: absolute; } .form-input + .form-label { position: relative; transition: transform 1s; } .form-input:focus + .form-label { transform: scale(0.8), translateY(50px); }
source share