Users log in every day on the web, so imagine how many times login forms are being used in a single day. Usually, it doesn’t take too much to fill a form like this, but using a dropdown solution will speed up things for you.
In this article, you will see how to create a good looking dropdown login form using CSS3 and a bit of jQuery.
The main purpose is to avoid waiting to load a separate page in order to log in. This way you can increase user experience, as the user has the possibility to log in immediately.
Ingredients
Remember the CSS3 buttons we’ve created using HTML entities as icons? In this article we’ll use entities again to show an arrow that indicates the current state for our dropdown login box: expanded or collapsed.
Comparing to the latest HTML5 & CSS3 login tutorial you’ve seen here, this one uses some jQuery code to animate the box when clicking on the login button.
Here’s the markup we’ll use to create our CSS3 dropdown login form box:
The login box CSS
There are quite a lot of CSS lines, but I think is worth it:
The login box jQuery code
The following code is quite self-explanatory. The if…else statement helps us indicate the current state for the login box. It basically toggle the span’s inner HTML between ▲ and ▼.
That’s it!
I hope you enjoyed this tutorial, thanks for reading!