Background
Break News
How to add local font to Tailwind Css and NextJS? - Tutorial Design Pattern? - Blockchain Technology, How to create own Bitcoin virtual currency - Zustand mordern management state - Design Pattern - Flyweight Pattern? - Docker Full training Topic

[Tips] How to build a beautiful slider Login Register form in 5 minutes

Sunday, 25 June 2023
|
Read: Completed in minutes

[Tips] How to build a beautiful slider Login Register form in 5 minutes

If you're looking for a way to spice up your website or app with a slider login register form, you've come to the right place. In this post, I will share with you how to create this awesome feature in just 5 minutes. You don't need any advanced skills or tools to follow along with me. Let's get started.

In this tutorial, you will learn how to build a beautiful HTML CSS slider login register in 5 minutes. A slider login register is a user interface element that allows users to switch between login and register forms by sliding the screen horizontally. This can create a smooth and elegant user experience for your website or application. You will use HTML to create the structure of the slider, CSS to style and animate the slider, and JavaScript to add interactivity and functionality to the slider. By following this tutorial, you will be able to create a responsive and modern slider login register that works on different devices and screen sizes.

👉 Here is full source code: link download (click into Free Access to download it)

 

How to build a beautiful slider Login Register form in 5 minutes


First I will introduce rhe Material I am using on this website is Ionicons, you can import library from this site

<script type="module" src="https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.esm.js"></script>

<script nomodule src="https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.js"></script>

Here is my full structure of website

How to build a beautiful slider Login Register form in 5 minutes

 HTML file

How to build a beautiful slider Login Register form in 5 minutes

On the class="formbox login" we will have two input email, password, one checkbox remember me, one button LogIn and one link is Sign up

<div class="formbox login">  

     <form>

        <h2> Sign In </h2>

        <div class="input-box">

            <span class="icon">

                <ion-icon name="mail-outline"></ion-icon>

            </span>

            <input type="email" id="email" required/> 

            <label for="email"> Email</label>

        </div>


        <div class="input-box">

            <span class="icon">

                <ion-icon name="logo-pwa"></ion-icon>

            </span>

            <input id="password" type="password" required /> 

            <label for="password"> Password</label>

        </div>


        <div class="remember-password">

            <label>

                <input type="checkbox" name="" id="Remember Me" />

                    Remember Me                                                

            </label>

            <a href="#"> Forgot password</a>

        </div>


        <button class="btn"> Log In </button>

            <div class="create-account">

                <p> Create An account? 

                    <a href="#" class="register-link"> Sign Up </a>

                </p>

            </div> 

    </form>

</div>

On the class="formbox register" we will have three input email, password, confirm password (this fields all required) , one button LogIn and one link is Sign In for swap between login and register from. So we will give a class name on this link is "login-link" for use later

<div class="formbox register">    

    <form action="">

        <h2> Sign Up </h2>

        <div class="input-box">

            <span class="icon">

                <ion-icon name="mail-outline"></ion-icon>

             </span>

            <input type="email" id="emailr" required/> 

            <label for="emailr"> Email</label>

        </div>


        <div class="input-box">

            <span class="icon">

                <ion-icon name="logo-pwa"></ion-icon>

            </span>

            <input type="password" id="passwordr" required /> 

            <label for="passwordr"> Password</label>

        </div>


        <div class="input-box">

           <span class="icon">

               <ion-icon name="logo-pwa"></ion-icon>

            </span>

            <input type="password" id="confirmpassword" required /> 

            <label for="confirmpassword"> Confirm Password</label>

        </div> 


        <button class="btn"> Sign Up </button>

        <div class="create-account">

            <p> Already have an account?

                <a href="#" class="login-link"> Sign In </a> 

            </p>

        </div>

   </form>

</div>

Here I will summary some main point

Added the background to your HTML, you can use background url, background-position: center for center the background on your view site. background-size: cover, and the min-height is 100vh for full height on your view

body {

    background: url('./img/bg.jpg');

    background-position: center;

    background-size: cover;

    min-height: 100vh;

    width: 100%;

}


For the animation when click into label email, password, we will see the label will float on top,

input {

    

    ...

 

    &:focus ~ label,

    &:valid ~ label {

        top: -10px;

    }

}


label {

    transform: translateY(-50%);

    transition:  0.3s ease-out;

}

If you want to have a red color on checkbox when you check on it, you can use accent-color style

.remember-password {

     ...    

     label {

         input {

             accent-color: red;             

         }

     }

For the click swap between your side Login and Register, you will have 2 file, one is javascript, and the css to do it

Javascript file you need to get the login section, get the login link, register link from document.querySelector, then you will be add Event Listener on click login and register link (just simple add active and remove active class on two section)

When login active will show login page, and register active will show the register page

registerLink.addEventListener('click', () => {

    login.classList.add('active'); 

})

loginLink.addEventListener('click', () => {

    login.classList.remove('active'); 

})

On CSS you will use transform: translateY to above or bottom current view (login-section), we use transition: transform 0.6s ease for smooth the animation.

first the login will show on currently place, so

&.login { 

    transform: translateY(0px);

    transition: transform .6s ease;

}

And the register need to hide

&.register {

            transform: translateY(-460px);

            transition: transform .6s ease;

}

I move this section on above -460px (and use over-flow:hidden on login-section hide it)

when login active I will transform this login from 0 -> 460px position same this, use transition-delay: 0.7s for a delay time if you dont want delay, and want to immediately move so no need to use this style

&.active {

        .formbox { 

            &.login {

                transform: translateY(460px);

                transition-delay: 0.7s;

            }

        }

}

.login-section { 

    transition: .3s;    

    overflow: hidden;

 

    .formbox {

       

        // logic: 

        // 1/ first position, register hidden on above 

        &.register {

            transform: translateY(-460px);

            transition: transform .6s ease;

        }


        &.login {

            transform: translateY(0px);

            transition: transform .6s ease;

        }

    }


    &.active {

        .formbox {

            // 2/ when register active 

            // login on bottom 460px (hide) Overflow: hidden


            &.register {

                transform: translateY(0);

                transition-delay: 0.7s;

            }

            

            &.login {

                transform: translateY(460px);

                transition-delay: 0.7s;

            }

        }

    }

}

And here is full video tutorial here


 

 

 

@learntechtips How to build a beautiful slider Login register form in 5 minutes#learntechtipszidane #css #loginform #html ♬ original sound - Learn Tech Tips in 60s
Thank you for reading this post. I hope you found it helpful and easy to follow. If you have any feedback or questions about How to build a beautiful slider Login Register form in 5 minutes, please share them in the comments below. I would love to hear from you and discuss this topic further
✋✋✋✋  Learn Tech Tips  - I am Zidane, See you next time soon ✋✋✋✋

🙇🏼🙇🏼 We Appreciate Your Comments and Suggestions - Webzone, all things Tech Tips web development
Popular Webzone Tech Tips topic maybe you will be like it - by Webzone Tech Tips - Zidane
As a student, I found Blogspot very useful when I joined in 2014. I have been a developer for years . To give back and share what I learned, I started Webzone, a blog with tech tips. You can also search for tech tips zidane on Google and find my helpful posts. Love you all,

I am glad you visited my blog. I hope you find it useful for learning tech tips and webzone tricks. If you have any technical issues, feel free to browse my posts and see if they can help you solve them. You can also leave a comment or contact me if you need more assistance. Here is my blog address: https://learn-tech-tips.blogspot.com.

My blog where I share my passion for web development, webzone design, and tech tips. You will find tutorials on how to build websites from scratch, using hot trends frameworks like nestjs, nextjs, cakephp, devops, docker, and more. You will also learn how to fix common bugs on development, like a mini stackoverflow. Plus, you will discover how to easily learn programming languages such as PHP (CAKEPHP, LARAVEL), C#, C++, Web(HTML, CSS, javascript), and other useful things like Office (Excel, Photoshop). I hope you enjoy my blog and find it helpful for your projects. :)

Thanks and Best Regards!
Follow me on Tiktok @learntechtips and send me a direct message. I will be happy to chat with you.
Webzone - Zidane (huuvi168@gmail.com)
I'm developer, I like code, I like to learn new technology and want to be friend with people for learn each other
I'm a developer who loves coding, learning new technologies, and making friends with people who share the same passion. I have been a full stack developer since 2015, with more than years of experience in web development.
Copyright @2022(November) Version 1.0.0 - By Webzone, all things Tech Tips for Web Development Zidane
https://learn-tech-tips.blogspot.com