Floating label on focus
How do I make an floating label on focus?
This is a css only solution to http://codepen.io/Timurtek/pen/LblHd pen. Just for fun, not so good to use it... ;). What is a floating label on focus? How do you make a floating label on focus? This script and codes were developed by Pedro Campos on 13 October 2022, Thursday.
Floating label on focus - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Floating label on focus</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="form"> <input type="text" name="email" id="email" required="required"> <label for="email">Email</label> <input type="password" name="password" id="password" required="required"> <label for="password">Password</label> <h1>Form Name</h1> <a href="#" class="forgot">Forgot Password?</a> <div class="bg"></div>
</div> <script src="js/index.js"></script>
</body>
</html>
Floating label on focus - Script Codes CSS Codes
body { height: 100%; min-height: 100%; margin: 0; background: url(http://www.timurtek.com/wp-content/uploads/2014/10/form-bg.jpg) no-repeat center center fixed; background-size: cover; font-family: arial;
}
html { height: 100%; }
.form { width: 264px; background-color: #ffffff; margin: 96px auto; padding: 96px 48px 48px 48px;
}
input[type="text"], input[type="password"] { position: relative; width: 240px; height: 44px; border: 1px solid #cccccc; padding: 0 12px; outline: none;
}
label { position: relative; top: -32px; left: 6px; padding: 0 6px; background-color: #ffffff; -webkit-transition: 0.2s linear; -moz-transition: 0.2s linear; transition: 0.2s linear;
}
input[type="text"]:focus + label, input[type="password"]:focus + label { top: -54px; }
input[type="text"]:valid + label, input[type="password"]:valid + label { top: -54px; }
/* background */
.bg { position: fixed; width: 100%; height: 100%; top: 0; left: 0; z-index: -1; background-color: rgba(0, 0, 0, 0.4); opacity: 0; -webkit-transition: 0.2s linear; -moz-transition: 0.2s linear; transition: 0.2s linear;
}
input[type="text"]:focus ~ .bg, input[type="password"]:focus ~ .bg { opacity: 1; }
/* h1 title */
h1 { margin: -190px 0 0 0; text-align: center; color: #cccccc; -webkit-transition: 0.2s linear; -moz-transition: 0.2s linear; transition: 0.2s linear;
}
input[type="text"]:focus ~ h1, input[type="password"]:focus ~ h1 { color: #58bff6; }
/* link */
.forgot { display: block; margin: 170px 0 0 0; color: #58bff6; outline: none;
}
.forgot:hover, .forgot:focus { color: #cccccc; }
Floating label on focus - Script Codes JS Codes
/* CSS only solution to https://codepen.io/Timurtek/pen/LblHd pen. */
Developer | Pedro Campos |
Username | pedrocampos |
Uploaded | October 13, 2022 |
Rating | 3 |
Size | 2,261 Kb |
Views | 26,312 |
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!
Name | Size |
Mobile menu icon animations | 2,576 Kb |
Form checkbox | 3,541 Kb |
WP8 start screen | 7,592 Kb |
Rotated text right | 1,858 Kb |
CSS eye follow | 2,592 Kb |
A Pen by Pedro Campos | 1,671 Kb |
Chekboxes CSS | 3,747 Kb |
Rows hover. Close popup. | 2,211 Kb |
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!
Name | Username | Size |
Google Maps API Ground Overlay | Boycetrus | 2,961 Kb |
Nice responsive team page | Infomiho | 3,139 Kb |
SVG Hover Animations | Kjbrum | 10,557 Kb |
Drawing a Terminal with CSS | Lachlanjc | 3,185 Kb |
Animate a paper plane along an SVG path, looking ahead | PotatoDie | 3,734 Kb |
Simple star rating using js and data-uri | TheEnd | 5,795 Kb |
Sticky menu on scroll | Senff | 2,869 Kb |
LeMandinque | Aadesida | 9,046 Kb |
Responsive Pricing Table | Jeremycaris | 2,690 Kb |
Retina canvas w. resize | Erikterwan | 1,882 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!