JSFiddle - React, Tailwind, and code Playground
HTML
<div class="signLog">
<h2 class="boxTitle">Sign Up</h2>
<form class="signupForm">
<div class="placeholding-input">
<input type="text" name="username" class="field" />
<span class="placeholder">Username</span>
</div>
<div class="placeholding-input">
<input type="email" name="email" class="field" />
<span class="placeholder">Email</span>
</div>
<div class="placeholding-input">
<input type="password" name="password" class="field" />
<span class="placeholder">Password</span>
</div>
<input type="submit" value="Create Account" />
<div class="clear"></div>
</form>
</div>
CSS
body {
font-family: 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, sans-serif;
padding: 100px;
font-size: 16px;
color: #3b3b3b;
background: #6BABFF;
}
.signLog {
position: relative;
background: #fff;
margin: 0 auto;
width: 300px;
/* border-radius */
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
/* box-shadow */
-webkit-box-shadow: rgba(0,0,0,0.2) 0px 1px 3px;
-moz-box-shadow: rgba(0,0,0,0.2) 0px 1px 3px;
box-shadow: rgba(0,0,0,0.2) 0px 1px 3px;
background: #ffffff;
background: -moz-linear-gradient(top, #ffffff 0%, #dddddd 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color-stop(100%,#dddddd));
background: -webkit-linear-gradient(top, #ffffff 0%,#dddddd 100%);
background: -o-linear-gradient(top, #ffffff 0%,#dddddd 100%);
background: -ms-linear-gradient(top, #ffffff 0%,#dddddd 100%);
background: linear-gradient(top, #ffffff 0%,#dddddd 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#dddddd',GradientType=0 );
}
.signupForm {
padding: 16px;
}
.placeholding-input {
position: relative;
font-size: 15px;
font-weight: normal;
}
.placeholder {
position: absolute;
top: 10px;
left: 14px;
color: #aaaaaa;
-moz-transition: all .08s ease;
-webkit-transition: all .08s ease;
-o-transition: all .08s ease;
}
.faded {
color: #cccccc;
}
.field {
margin: 0 0 8px 0;
padding: 8px 12px;
width: 242px;
color: #777777;
font-size: 15px;
font-weight: normal;
border: 1px solid #ccc;
border-radius: 4px;
outline: none;
box-shadow: 0 1px 0 #eeeeee inset, 0 1px 0 #ffffff;
display: block;
background: #ffffff;
-moz-transition: all .08s ease;
-webkit-transition: all .08s ease;
-o-transition: all .08s ease;
}
.field:focus {
border: 1px solid #6BABFF;
outline:...
JavaScript
$('.field').each(function () {
if ($(this).val() != '') {
$(this).parent('.placeholding-input').children('.placeholder').hide();
}
});
$('.placeholder').click(function() {
var thisField = $(this).parent('.placeholding-input').children('.field');
$(thisField ).trigger('focus');
});
$('.placeholding-input input').bind("propertychange keydown input paste", function(event){
$(this).parent('.placeholding-input').children('.placeholder').hide();
});
$('.placeholding-input input').focus(function() {
$(this).parent('.placeholding-input').children('.placeholder').addClass('faded');
});
$('.placeholding-input input').blur(function() {
if($(this).val() == ''){
$(this).parent('.placeholding-input').children('.placeholder').show().removeClass('faded');
} else {
}
});