"Input Materialized with CSS"
Bootstrap 4.1.1 Snippet by paulohnmatos

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<div class="container">
<div class="row">
<section>
<form action="">
<h1>Material Design Input with pure CSS</h1>
<div class="input-container">
<input id="name" class="input" type="text" pattern=".+" required />
<label class="label" for="name">Nome</label>
</div>
</form>
</section>
</div>
</div>
<!--I was not the one who developed this input,
below is the original font.-->
<a href="https://mariosouto.com/inputs-materializados-com-css/">Mario Souto</a>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/* Estrutura */
.input-container {
position: relative;
}
input {
border: 0;
border-bottom: 2px solid #9e9e9e;
outline: none;
transition: .2s ease-in-out;
box-sizing: border-box;
}
label {
top: 0;
left: 0; right: 0;
color: #616161;
display: flex;
align-items: center;
position: absolute;
font-size: 1rem;
cursor: text;
transition: .2s ease-in-out;
box-sizing: border-box;
}
input,
label {
width: 100%;
height: 3rem;
font-size: 1rem;
}
/* Interation */
input:valid,
input:focus {
border-bottom: 2px solid #26a69a;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Related: See More


Questions / Comments: