Skip to content

Instantly share code, notes, and snippets.

@pbexe
Forked from anonymous/index.html
Created February 28, 2016 19:47
Show Gist options
  • Save pbexe/cf401417a307692e6c3f to your computer and use it in GitHub Desktop.
Save pbexe/cf401417a307692e6c3f to your computer and use it in GitHub Desktop.
subr.pw
<form>
<div class="input-field full">
<label for="email">Long URL</label>
<input id="email" type="email">
</div><span class="title">0 New shortlinks</span>
</form>
$('input').focus(function(){
var label = $("[for='" + $(this).attr('id') + "']")
label.addClass('raised highlight')
})
$('input').blur(function(){
var label = $("[for='" + $(this).attr('id') + "']")
label.removeClass('highlight')
if($(this).val().length == 0){
label.removeClass('raised')
}
})
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
html {
box-sizing: border-box;
}
*,
*:before,
*:after {
box-sizing: inherit;
-webkit-font-smoothing: antialiased;
}
body {
font-family: "proxima-nova";
background: #001F3F;
}
form {
display: flex;
flex-direction: row;
flex-wrap: wrap;
margin: 4rem auto 0;
max-width: 26rem;
}
.title {
color: rgba(255, 255, 255, .4);
font-family: "proxima-nova";
padding: 0rem .5em 2em;
font-size: .6rem;
text-transform: uppercase;
font-weight: 100;
letter-spacing: 2px;
}
.input-field {
padding: 0 .5em 2em;
}
.input-field.half {
flex: 1 0 50%;
}
.input-field.full {
flex: 2 0 100%;
}
label {
font-family: "proxima-nova";
display: block;
position: relative;
z-index: -9;
top: 1.5rem;
color: rgba(255, 255, 255, .4);
font-size: .875rem;
text-transform: uppercase;
font-weight: 600;
letter-spacing: 2px;
transition: top .3s ease, color .3s ease;
}
label.raised {
top: 0rem;
}
label.highlight {
color: rgba(255, 255, 255, .6);
}
[type="text"],
[type="email"] {
color: rgba(255, 255, 255, .4);
font-family: "proxima-nova";
padding: .25rem 0 0;
font-size: 1.25rem;
font-weight: 400;
width: 100%;
border: none;
border-bottom: 1px solid;
background: none;
transition: color .3s ease;
}
[type="text"]:focus,
[type="email"]:focus {
color: rgba(255, 255, 255, 1);
outline: 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment