Floating Labels Form

Size
3,113 Kb
Views
40,480

How do I make an floating labels form?

On focus labels animate above fields. required fields are noted by a blinking asterisk.. What is a floating labels form? How do you make a floating labels form? This script and codes were developed by Nicholas M. Smith on 27 August 2022, Saturday.

Floating Labels Form Previews

Floating Labels Form - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Floating Labels Form</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body>
<link href='https://fonts.googleapis.com/css?family=Josefin+Sans|Carrois+Gothic+SC|Metrophobic' rel='stylesheet' type='text/css'>
<h1>Form Floating Labels</h1>
<div class="container"> <form action="#"> <div> <input id="name" name="name" type="text" required> <label class="required" for="name">Name</label> </div> <div> <input id="email" name="email" type="email" required> <label class="required" for="email">Email</label> </div> <div> <textarea id="message" name="phone" required></textarea> <label for="message">Message</label> </div> <input type="submit" value="Send!"> <p class="footnote">* Required Fields</p> </form>
</div> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
</body>
</html>

Floating Labels Form - Script Codes CSS Codes

* { box-sizing: border-box;
}
body { background: #f17f5b; font-family: 'Josefin Sans', sans-serif;
}
h1 { color: white; font-size: 3em; font-weight: 100; padding-bottom: 50px; text-align: center;
}
.footnote { color: white; font-size: 0.8em;
}
.container { display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-align: center; -ms-flex-align: center; align-items: center; -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center; height: 400px; width: 100%;
}
form { width: 50%; min-width: 400px; max-width: 400px; padding: 0 0 30px 0;
}
div { position: relative; padding: 15px 0;
}
label { color: #999; cursor: text; font-size: 1.5em; position: absolute; top: 27px; left: 10px; -webkit-transition: all 0.15s linear; transition: all 0.15s linear;
}
input, textarea { border: none; font-size: 1.5em; outline: none; overflow: hidden; padding: 10px; width: 100%; z-index: 1;
}
input:valid, textarea:valid { background: white;
}
input:valid + label, textarea:valid + label { color: white; font-size: 1em; top: -5px; left: 0;
}
textarea { height: 250px;
}
input:focus + label,
textarea:focus + label { -webkit-animation: animateLabels 1s forwards; animation: animateLabels 1s forwards; color: white; font-size: 1em; top: -5px; left: 0;
}
.required:after { color: white; content: "*"; padding-left: 3px;
}
input:focus + .required:after { color: white; content: "*"; padding-left: 3px;
}
input[type="submit"] { float: right; padding-bottom: 8px; width: 200px;
}
@-webkit-keyframes animateLabels { 0% { opacity: 0; left: 0; top: -10px; } 100% { opacity: 1; left: 0; top: -5px; }
}
@keyframes animateLabels { 0% { opacity: 0; left: 0; top: -10px; } 100% { opacity: 1; left: 0; top: -5px; }
}
Floating Labels Form - Script Codes
Floating Labels Form - Script Codes
Home Page Home
Developer Nicholas M. Smith
Username icutpeople
Uploaded August 27, 2022
Rating 3.5
Size 3,113 Kb
Views 40,480
Do you need developer help for Floating Labels Form?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Nicholas M. Smith (icutpeople) Script Codes
Create amazing captions with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!