drifterz28
11/24/2014 - 12:07 AM

label show on focus

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>