A Pen by Adam Grabek on CodePen.
Created
May 26, 2016 20:15
-
-
Save AGmakonts/903dbcac776e1428741435a6a08c585d to your computer and use it in GitHub Desktop.
Animated label for rounded button
This file contains hidden or 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> | |
<label for="name"> | |
<input name="name" id="name" placeholder="name"> | |
<span>Username</span> | |
</label> | |
</div> |
This file contains hidden or 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 { | |
width: 400px; | |
padding: 40px; | |
} | |
* { | |
transition: all 200ms ease; | |
} | |
label { | |
display: flex; | |
flex-direction: column-reverse; | |
} | |
span { | |
font-weight: 700; | |
} | |
input, span { | |
font-family: Raleway; | |
font-size: 15px; | |
position:relative; | |
cursor: text; | |
} | |
input:focus { | |
border-color: #376969 | |
} | |
input:focus + span { | |
color: #376969 | |
} | |
input:focus + span, input:not(:placeholder-shown) + span { | |
top:0; | |
} | |
input::-webkit-input-placeholder { | |
color: white; | |
} | |
span { | |
margin-left: 26px; | |
top: 27px; | |
margin-bottom: 10px; | |
} | |
input { | |
font-weiht: 300; | |
outline: none; | |
height: 30px; | |
appearance: none; | |
-webkit-appearance: none; | |
border: none; | |
border-bottom: 1px solid black; | |
border-left: 1px solid black; | |
border-bottom-left-radius: 24px; | |
box-sizing: border-box; | |
padding: 0 0 12px 23px | |
} |
This file contains hidden or 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
<link href="https://fonts.googleapis.com/css?family=Raleway:300,500,700" rel="stylesheet" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment