Created
August 9, 2014 12:29
-
-
Save g-dormoy/c7e1e11118ab11a9d9f5 to your computer and use it in GitHub Desktop.
A Pen by Ferncoder.
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 class='fern-textInput'> | |
<input type=text required /> | |
<label class='fern-textInput-label'>Name</label> | |
<span class='fern-textInput-validity'></span> | |
<span class='fern-textInput-loader'></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
body { | |
background-color: rgb(114, 148, 191); | |
} | |
.fern-textInput { | |
width: 150px; | |
height: 50px; | |
margin: 60px auto; | |
position: relative; | |
} | |
.fern-textInput input { | |
display: block; | |
position: absolute; | |
top: 20px; /* make it go to the bottom */ | |
width: 150px; | |
padding: 0px; | |
padding-left: 5px; | |
border: none; | |
background: transparent; | |
height: 30px; | |
z-index: 5; | |
} | |
.fern-textInput .fern-textInput-loader { | |
position: absolute; | |
width: 150px; | |
height: 3px; | |
top: 47px; | |
opacity: 0.5; | |
background-color: #FAFAFA; | |
z-index: 2; | |
transition: all ease 0.3s; | |
} | |
.fern-textInput .fern-textInput-label { | |
position: absolute; | |
top: 23px; | |
left: 15px; | |
font-size: 14px; | |
tansform: translateY(-50%); | |
opacity: 0.5; | |
font-weight: 800; | |
z-index: 3; | |
transition: all ease 0.3s; | |
} | |
.fern-textInput .fern-textInput-validity { | |
position: absolute; | |
left: 50%; | |
top: 47px; | |
height: 3px; | |
width: 0px; | |
background-color: #555555; | |
z-index: 6; | |
transition: all ease 0.3s; | |
} | |
.fern-textInput input:focus ~ .fern-textInput-label, .fern-textInput input:valid ~ .fern-textInput-label { | |
top: 5px; | |
opacity: 1; | |
left: 5px; | |
font-size: 12px; | |
} | |
.fern-textInput input:focus ~ .fern-textInput-loader, .fern-textInput input:valid ~ .fern-textInput-loader { | |
height: 30px; | |
top: 20px; | |
} | |
.fern-textInput input:focus ~ .fern-textInput-validity, .fern-textInput input:valid ~ .fern-textInput-validity { | |
width: 150px; | |
left: 0px; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment