Simple Login Form with Placeholder Animation

In this tutorial we will see how to make a Simple Login Form with Placeholder Animation. Simple CSS is used for this purpose, HTML code and CSS code is given.

HTML Code

HTML Code is given below.

<form class="form">
    <h1>Login Form</h1>
    <p>Please Enter Login Details</p>
    <div class="input-group">
        <input type="email" class="input">
        <label class="placeholder">Email</label>
    </div>
    <div class="input-group">
        <input type="password" class="input">
        <label class="placeholder">Password</label>
    </div>
    <input class="submit" type="submit" value="Login">
</form>

CSS Code

CSS Code is given below.

body
{
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background-color: #5469D4;
    font-family: 'Barlow Condensed' , sans-serif;
}
.form
{
    background-color: #fff;
    padding: 20px;
    width: 100%;
    max-width: 300px;
    box-sizing: border-box;
    border-radius: 5px;
    box-shadow: 0px 0px 10px 0px #666;
}
.form h1
{
    font-size: 24px;
    text-align: center;
    margin-bottom: 30px;
}
.form p
{
    font-size: 16px;
    margin: 40px 0px 0px 0px;
}
.input
{
    padding: 10px;
    width: 100%;
    box-sizing: border-box;
    max-width: 300px;
    outline: none;
    border: 1px solid #5469D4;
}
.input-group
{
    position: relative;
    margin: 30px 0px;
}
.placeholder
{
    position: absolute;
    top: 10px;
    left: 8px;
    font-size: 14px;
    padding: 0px 5px;
    color: #333;
    transition: top 0.3s;
    pointer-events: none;
    background-color: #fff;top: -10px;
}
.submit
{
    background-color: #5469D4;
    color: #fff;
    border: 0px;
    padding: 5px 10px;
    cursor: pointer;
    float: right;
    box-shadow: 0px 0px 3px 0px #666;
}
.input:focus + .placeholder
{
    top: -10px;
}

Demo

Video Tutorial

Watch our video tutorial on Simple Login Form with Placeholder Animation.

Responsive Sidebar Menu with CSS and JavaScript Cool CSS Button with Hover Animation Pure CSS Custom Radio Buttons Custom Emoji Radio Buttons with CSS Color Picker Design with HTML CSS and JavaScript Custom Radio Buttons with CSS Engraved HTML Buttons With CSS Neumorphic Buttons Design with CSS Cool Profile Card Design with HTML CSS Neumorphic Search Bar Design with HTML and CSS Simple Login Form with Placeholder Animation Pure CSS Button with Folded Corner Background Color Change Slider with HTML CSS and JavaScript 404 Page Not Found Template Design with HTML and CSS Movies Blog Card Design with HTML and CSS Simple CSS Border Animation with before and after Selector Custom Social Select Dropdown Menu with CSS and JavaScript Facebook Offline and Online Notification with CSS and JS New Year 2022 Text Animation with CSS and JS Change Placeholder Color using CSS Custom Select Tag DropDown with CSS and JavaScript Simple Price Range Slider With HTML CSS and JavaScript Profile Card With Hover Effect using HTML and CSS Circle With Two Colors using CSS Simple FAQ Accordion With HTML CSS and JavaScript