<form>
<label>
<span>First Name</span>
<input type="text" pattern=".{3,}" placeholder=" " required title="Enter at least 3 characters.">
</label>
<button>Submit</button>
</form>
span {
display: block;
margin: 0 0 5px 12px;
}
input {
border: 2px solid #f2f2f2;
outline: none;
}
input:focus {
border-color: #d9d9d9;
}
input:valid {
border-color: #42d142;
}
input:invalid {
border-color: #ff8e7a;
}
input:placeholder-shown {
border-color: #d9d9d9;
}
body {
display: flex;
min-height: 100vh;
background: #f1f1f1;
font-family: 'Lato', sans-serif;
font-size: 150%;
}
form {
margin: auto;
}
input, button {
padding: 15px 20px;
border-radius: 1px;
border: 2px solid #bdbdbd;
}
button {
border-color: #616161;
background: #616161;
color: #f6f7f8;
text-transform: uppercase;
letter-spacing: 2px;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.