Last active
November 21, 2016 12:11
-
-
Save rubinchyk/8398ca7bfec84ca05f62 to your computer and use it in GitHub Desktop.
CSS-Animation: Border bottom filling from left to right green line.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div> | |
<input class="dollar-value" type="text" /> | |
<span class="animation-border"></span> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Need 'Bourbon' for includes | |
$green: #00d246; | |
$grey: #989c9f; | |
.dollar { | |
position: absolute; | |
color: $green; | |
font-size: 18px; | |
font-weight: 400; | |
left: 58px | |
} | |
.dollar-value { | |
border: none; | |
font-size: 18px; | |
border-bottom: 2px solid $grey; | |
width: 221px; | |
border-radius: 1px; | |
padding-left: 30px; | |
margin-left: 50px; | |
&:focus { | |
outline: 0; | |
} | |
&:focus + .animation-border { | |
@include animation-name(green-line-focus); | |
@include animation-duration(.5s); | |
@include animation-timing-function(ease-in-out); | |
@include animation-fill-mode(forwards); | |
} | |
} | |
@include keyframes(green-line-focus) { | |
from { | |
padding-left: 0; | |
width: 0; | |
} | |
to { | |
padding-left: 30px; | |
width: 221px; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment