Skip to content

Instantly share code, notes, and snippets.

@drifterz28
Last active August 29, 2015 14:10
Show Gist options
  • Select an option

  • Save drifterz28/775374d564de02df3439 to your computer and use it in GitHub Desktop.

Select an option

Save drifterz28/775374d564de02df3439 to your computer and use it in GitHub Desktop.
label show on focus
<style>
.input_wrapper {
position: relative;
margin-top: 24px;
float: left;
width: 100%;
margin-bottom: 20px;
}
input {
position: absolute;
left: 0;
top: 0;
z-index: 1;
}
label {
position: absolute;
top: 0;
transition: all 0.2s ease;
}
input:focus + label {
-webkit-transform: translateY(-20px);
transform: translateY(-20px);
}
</style>
<div class="input_wrapper">
<input type="text" placeholder="Name" />
<label>Name</label>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment