Toggle navigation
Bootsnipp
Bootstrap
For
CSS Frameworks
Bootstrap
Foundation
Semantic UI
Materialize
Pure
Bulma
References
CSS Reference
Tools
Community
Page Builder
Form Builder
Button Builder
Icon Search
Dan's Tools
Diff / Merge
Color Picker
Keyword Tool
Web Fonts
.htaccess Generator
Favicon Generator
Site Speed Test
Snippets
Featured
Tags
By Bootstrap Version
4.1.1
4.0.0
3.3.0
3.2.0
3.1.0
3.0.3
3.0.1
3.0.0
2.3.2
Register
Login
"materialize like input"
Bootstrap 3.0.0 Snippet by
ashum499
3.0.0
jQuery
input
Preview
HTML
CSS
JS
View Full Screen
Fork
Fork this
11.7K
 
3 Fav
Post to Facebook
Tweet this
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <!------ Include the above in your HEAD tag ----------> <div class="container"> <div class="row"> <h2>Material design input.</h2> <div class="mat-input"> <div class="mat-input-outer"> <input type="text" autocomplete="off"/> <label class="">Enter your Name</label> <div class="border"></div> </div> </div> </div> </div>
/*MATERIAL INPUT*/ h2{ font-family:calibri; color:purple; text-align:center; } .mat-input{ margin: 2% auto; width: 50%; } .mat-input-outer{ display: table; width: 100%; position: relative; } .mat-input-outer input{ height: 50px; border-radius: 0; border: none; width: 100%; padding: 0 15px; font-family: calibri; font-size: 20px; font-style: italic; } .mat-input-outer label{ font-family: calibri; font-size: 20px; left: 15px; position: absolute; top: 18px; font-style: italic; transition: .2s; color: #000; cursor: text; font-weight: normal; opacity: 0.4; filter: alpha(opacity=40); } .mat-input-outer .border{ height: 1px; background: #000; transition: .3s; -webkit-transition: .3s; -ms-transition: .3s; } .mat-input-outer .border::before{ content: " "; display: table; height: 3px; width: 0%; background: transparent; transition: .3s; -webkit-transition: .3s; -ms-transition: .3s; margin: 0 auto; } .mat-input-outer input:focus ~ .border{ background: transparent; } .mat-input-outer input:focus ~ .border::before{ width: 100%; background: purple; } .mat-input-outer input + label.active{ left: 5px; top: -25px; color: purple; opacity: 1; filter: alpha(opacity=100); }
$(function () { $('.mat-input-outer label').click(function () { $(this).prev('input').focus(); }); $('.mat-input-outer input').focusin(function () { $(this).next('label').addClass('active'); }); $('.mat-input-outer input').focusout(function () { if (!$(this).val()) { $(this).next('label').removeClass('active'); } else { $(this).next('label').addClass('active'); } }); });
Questions / Comments:
Post
Posting Guidelines
Formatting
- Now
×
Close
Donate
BTC: 12JxYMYi6Vt3mx3hcmP3B2oyFiCSF3FhYT
ETH: 0xCD715b2E3549c54A40e6ecAaFeB82138148a6c76