Skip to content

Instantly share code, notes, and snippets.

@VinSpee
Created February 11, 2014 15:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save VinSpee/8937715 to your computer and use it in GitHub Desktop.
Save VinSpee/8937715 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
<form>
<div class="field">
<input type="text" pattern=".+" required="" placeholder="First Name"><label>First Name</label>
</div> <div class="field">
<input type="text" pattern=".+" required="" placeholder="Last Name"><label>Last Name</label>
</div>
</form>
// ----
// Sass (v3.3.0.rc.3)
// Compass (v1.0.0.alpha.18)
// ----
.field
position: relative
font-family: Arial
text-transform: uppercase
font-weight: bold
display: inline-block
label
position: absolute
left: 0
top: 0
transition: all .2s linear
color: #999
font-size: 10px
input
margin-top: 15px
border: 1px solid #999
padding: 3px 2px
input:invalid + label
top: 3px
opacity: 0
input:valid + label
opacity: 1
top: 0
input:focus
outline: none
input:focus + label
color: #33A
.field {
position: relative;
font-family: Arial;
text-transform: uppercase;
font-weight: bold;
display: inline-block;
}
label {
position: absolute;
left: 0;
top: 0;
transition: all .2s linear;
color: #999;
font-size: 10px;
}
input {
margin-top: 15px;
border: 1px solid #999;
padding: 3px 2px;
}
input:invalid + label {
top: 3px;
opacity: 0;
}
input:valid + label {
opacity: 1;
top: 0;
}
input:focus {
outline: none;
}
input:focus + label {
color: #33A;
}
<form>
<div class="field">
<input type="text" pattern=".+" required="" placeholder="First Name"><label>First Name</label>
</div> <div class="field">
<input type="text" pattern=".+" required="" placeholder="Last Name"><label>Last Name</label>
</div>
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment