Advertisement
  1. Web Design
  2. UX/UI

Smarten Up a Slick Login Form With CSS3

Scroll to top

Let's create a minimal and slick login form using basic HTML5 then enhancing it with some CSS3 techniques. Time to transform some simple elements into something beautiful..

Looking for a Shortcut?

If you want some beautiful CSS3 forms for your site and don't want to have to create them yourself, you can't go wrong with CSS3 Form Pack on Envato Market. For just $5, you get:

  • 33 login form styles
  • 66 search form styles
  • 12 contact form styles
  • a general form that features styles for text box, textarea, radio button, checkbox, select box
  • various colour styles for each form

No wonder it's one of the best-selling CSS3 form items on Envato Market.

CSS3 Form Pack on Envato MarketCSS3 Form Pack on Envato MarketCSS3 Form Pack on Envato Market
CSS3 Form Pack on Envato Market

Introduction

Web forms are an integral part of a website’s design. Whatever the purpose, forms are intended to be a simple way for users to input values and submit data. Having HTML5 and CSS3 at our disposal, allows us to create forms that are both intuitive to use and visually appealing.


The Design

I believe that web design should be clean and efficient. The form design that we are going to be coding follows those principals, including just three elements: a username input, a password input, and a submit input. Because the markup is so simple, it allows for more flexibility when we code it into HTML and CSS.

Here are some elements in the design that we will need to keep in mind for coding:

  • Gradients
  • Inner Shadows
  • Borders with Opacity
  • Text Shadows
  • Placeholder Text

Most elements are CSS styling, but we will check out the placeholder attribute as well, since that will suggest to our users what kind of data they should enter.


Step 1: Base HTML and CSS Structure

Let’s start off by creating a clean HTML5 template with a form and three inputs:

1
<!DOCTYPE html>
2
<html lang="en">
3
4
<head>
5
	<meta charset="utf-8">
6
	<title>slick Login</title>
7
	<meta name="description" content="slick Login">
8
	<meta name="author" content="Webdesigntuts+">
9
</head>
10
11
<body>
12
	<form>
13
		<input type="text" name="username">
14
		<input type="password" name="password">
15
		<input type="submit" value="Log In">
16
	</form>
17
</body>
18
	
19
</html>

Right now, we don’t have anything too special, just a form, three inputs and a blank document. Let’s create a CSS file called style.css and link it back to our HTML page:

1
<link rel="stylesheet" type="text/css" href="style.css" />

Remember, the CSS file is currently located in our main directory; make sure you use the correct path if you choose to put your CSS file in another folder, such as the folder ‘css’.

Before we add any of our own styling to the CSS file, it is always good practice to start off from a clean slate. We'll start off our styles with Eric Meyer's CSS Reset which removes default styling and allows us to build our rules from the same point in whichever browser.

Let’s start off with defining a font and background gradient for our login page. Insert this code after the CSS reset:

1
body {
2
	font-family: sans-serif;
3
	
4
	background-color: #323B55;
5
	background-image: -webkit-linear-gradient(bottom, #323B55 0%, #424F71 100%);
6
	background-image: -moz-linear-gradient(bottom, #323B55 0%, #424F71 100%);
7
	background-image: -o-linear-gradient(bottom, #323B55 0%, #424F71 100%);
8
	background-image: -ms-linear-gradient(bottom, #323B55 0%, #424F71 100%);
9
	background-image: linear-gradient(bottom, #323B55 0%, #424F71 100%);
10
}

Now that we've added in that piece of code, our page should now have a cool linear gradient background. The gradient starts at the bottom of the page (0%) where the color is #323B55 and ends at the top of the page (100%) where the color is #424F71. Just incase the page is viewed from a browser which doesn't support gradients, it is important to declare a background-color, which I set to the same color as the gradient at 0%. The great thing about CSS3 gradients is that you can add many 'stops', for example another color change at 25%. The last thing to add in the body tag is the font-family, I decided to use the Sans Serif type.

Now that we have our foundation, it is time to start adding some more styling!


Step 2: Styling the Login Form

Before we start the CSS styling for the login form, we need to add some stuff to our HTML document. First, start off with adding an id to the form, we will call it 'slick-login'. Next, add a placeholder attribute in each of the input tags. Here is how the HTML page should look so far:

1
<!DOCTYPE html>
2
<html lang="en">
3
4
<head>
5
	<meta charset="utf-8">
6
	<title>slick Login</title>
7
	<meta name="description" content="slick Login">
8
	<meta name="author" content="Webdesigntuts+">
9
	<link rel="stylesheet" type="text/css" href="style.css" />
10
</head>
11
12
<body>
13
	<form id="slick-login">
14
		<input type="text" name="username" placeholder="me@tutsplus.com">
15
		<input type="password" name="password" placeholder="password">
16
		<input type="submit" value="Log In">
17
	</form>
18
</body>
19
20
</html>

The HTML5 input placeholder attribute is a great addition to input tags. Instead of having an input value that the user has to replace, the placeholder attribute allows us to display help text and have it disappear once the user starts to type in the field. It's not yet widely supported, and should therefore be used with caution. Say, for example, the placeholder attribute does not work in a browser, the user will not know what values to enter. Later on we'll be covering a fallback technique, but it's also worth nothing that placeholder text should be a suggestion, rather than labeling the input.

Now that we have our updated HTML page, we can start adding some styling to the login forms. Here is the CSS for our form id which we declared before.

1
#slick-login {
2
	width: 220px;
3
	height: 155px;
4
	position: absolute;
5
	left: 50%;
6
	top: 50%;
7
	margin-left: -110px;
8
	margin-top: -75px;
9
}

For this login form, I decided to align it perfectly (horizontally and vertically) in the center of the page. It is quite straight-forward to position elements like this. As you can see from the code above, position the element 50% from the top and left, and then using the margin values, push back the element half of the width and height. This is a great method to align elements in the center of the page, but it isn't that great in terms of flexibility. For example, if you would like to duplicate elements, you would have to change the width, height and margin values in order to keep the element aligned. Even though I aligned the form in the center of the page, feel free to change the code to whatever you like!

Now that we have our form aligned, it's time to move on to styling the inputs!


Step 3: Styling the Inputs

Now, we are really getting to the fun stuff. Lets start off by adding the CSS for the text and password inputs:

1
#slick-login input[type="text"],#slick-login input[type="password"] {
2
	width: 100%;
3
	height: 40px;
4
	positon: relative;
5
	margin-top: 7px;
6
	font-size: 14px;
7
	color: #444;
8
	outline: none;
9
	border: 1px solid rgba(0, 0, 0, .49);
10
11
	padding-left: 20px;
12
	
13
	-webkit-background-clip: padding-box;
14
	-moz-background-clip: padding-box;
15
	background-clip: padding-box;
16
	border-radius: 6px;
17
18
	background-color: #fff;
19
	background-image: -webkit-linear-gradient(bottom, #FFFFFF 0%, #F2F2F2 100%);
20
	background-image: -moz-linear-gradient(bottom, #FFFFFF 0%, #F2F2F2 100%);
21
	background-image: -o-linear-gradient(bottom, #FFFFFF 0%, #F2F2F2 100%);
22
	background-image: -ms-linear-gradient(bottom, #FFFFFF 0%, #F2F2F2 100%);
23
	background-image: linear-gradient(bottom, #FFFFFF 0%, #F2F2F2 100%);
24
25
	-webkit-box-shadow: inset 0px 2px 0px #d9d9d9;
26
	box-shadow: inset 0px 2px 0px #d9d9d9;
27
28
}
29
30
#slick-login input[type="text"]:focus,#slick-login input[type="password"]:focus {
31
	-webkit-box-shadow: inset 0px 2px 0px #a7a7a7;
32
	box-shadow: inset 0px 2px 0px #a7a7a7;
33
}
34
35
#slick-login input:first-child {
36
	margin-top: 0px;
37
}

Remember, our goal is to make the form flexible. Instead of declaring a fixed input width, I decided to make the width relative to the form's width. This way, if we decided to change the width of the form, all the inputs will change accordingly.

Because we declared a margin-top value for all the inputs, we need to add a first-child selector and make sure the margin-top of the first input is set to zero. This way, the first input value will always be positioned at the top of the form.

Another thing to keep in mind is setting the outline property to none, so that the browser doesn't add any unwanted outlines to our inputs.

Transparent Borders

To make the form more flexible, we are going to add a transparent border, so that whatever background the website has, the form will change to suit it. Because the opacity attribute changes the opacity of the whole element, I decided to search for a method to just change the border opacity.
If you declare the border color in rgba, it is possible to add an alpha value. As you can see above, our border is a solid 1px black border, but its opacity is 47%.

The Padding Problem

In our design, the text in the field is shifted to the right. To achieve this effect in CSS, we can simply use the padding-left property and set it to 20px. When we render the code, a problem arises. The padding value adds 20 pixels to the input width, which is not what we would like.

In order to fix this, we can add a background-clip property and set the value to padding-box. This snippet of CSS makes sure that the padding does not affect the width of the input. You can learn more about the background-clip property at Mozilla.

Adding the Inner Shadow

Another very cool CSS3 property is box-shadow. Using the inset parameter allows us to create an inner shadow on the input element. Using the focus selector, we can easily change the values and colors around when the user clicks on the field.


Step 4: Styling the Submit Button

The submit button is a very important part of a form, so let's make it stand out! Here is the CSS we are going to be using for the submit input:

1
#slick-login input[type="submit"] {
2
	width: 100%;
3
	height: 50px;
4
	margin-top: 7px;
5
	color: #fff;
6
	font-size: 18px;
7
	font-weight: bold;
8
	text-shadow: 0px -1px 0px #5b6ddc;
9
	outline: none;
10
	border: 1px solid rgba(0, 0, 0, .49);
11
12
	-webkit-background-clip: padding-box;
13
	-moz-background-clip: padding-box;
14
	background-clip: padding-box;
15
	border-radius: 6px;
16
17
	background-color: #5466da;
18
	background-image: -webkit-linear-gradient(bottom, #5466da 0%, #768ee4 100%);
19
	background-image: -moz-linear-gradient(bottom, #5466da 0%, #768ee4 100%);
20
	background-image: -o-linear-gradient(bottom, #5466da 0%, #768ee4 100%);
21
	background-image: -ms-linear-gradient(bottom, #5466da 0%, #768ee4 100%);
22
	background-image: linear-gradient(bottom, #5466da 0%, #768ee4 100%);
23
24
	cursor: pointer;
25
	
26
	-webkit-box-shadow: inset 0px 1px 0px #9ab1ec;
27
	box-shadow: inset 0px 1px 0px #9ab1ec;
28
29
}
30
31
#slick-login input[type="submit"]:hover {
32
	background-color: #5f73e9;
33
	background-image: -webkit-linear-gradient(bottom, #5f73e9 0%, #859bef 100%);
34
	background-image: -moz-linear-gradient(bottom, #5f73e9 0%, #859bef 100%);
35
	background-image: -o-linear-gradient(bottom, #5f73e9 0%, #859bef 100%);
36
	background-image: -ms-linear-gradient(bottom, #5f73e9 0%, #859bef 100%);
37
	background-image: linear-gradient(bottom, #5f73e9 0%, #859bef 100%);
38
39
	-webkit-box-shadow: inset 0px 1px 0px #aab9f4;
40
	box-shadow: inset 0px 1px 0px #aab9f4;
41
	
42
	margin-top: 10px;
43
}
44
45
#slick-login input[type="submit"]:active {
46
	background-color: #7588e1;
47
	background-image: -webkit-linear-gradient(bottom, #7588e1 0%, #7184df 100%);
48
	background-image: -moz-linear-gradient(bottom, #7588e1 0%, #7184df 100%);
49
	background-image: -o-linear-gradient(bottom, #7588e1 0%, #7184df 100%);
50
	background-image: -ms-linear-gradient(bottom, #7588e1 0%, #7184df 100%);
51
	background-image: linear-gradient(bottom, #7588e1 0%, #7184df 100%);
52
53
	-webkit-box-shadow: inset 0px 1px 0px #93a9e9;
54
	box-shadow: inset 0px 1px 0px #93a9e9;
55
}

The CSS for our submit button is quite straight forward; we're using borders, gradients and inner shadows to make the button stand out. Another CSS3 property we are going to look at is text-shadow.

To make the button text stand out a bit more, we will add a 1px solid shadow on top of the text. Using a darker color (#5b6ddc), we can make the white text more prominent against the light blue background. Even the most subtle effect like adding a text shadow can add a lot to your design, helping text stand out.

I went ahead and added the code for the hover and active selectors. All that is changed is the color of the gradient and the inner shadow. Notice how the color change is rather subtle, but it adds a lot to the design. I also changed the value of margin-top to three pixels lower on the hover state. The change feels natural and adds to the elegance of the form.

So far, everything looks great, but if you hover over and click on some elements, it seems a little choppy. Time to add some animation!


Step 5: Adding Transitions to Elements

To make things flow a lot better, let's add this bit of CSS code to our inputs:

1
-webkit-transition: all .1s ease-in-out;
2
-moz-transition: all .1s ease-in-out;
3
-o-transition: all .1s ease-in-out;
4
-ms-transition: all .1s ease-in-out;
5
transition: all .1s ease-in-out;

Using a quick and simple transition, all our elements look and feel a lot better. Notice the transition of inner shadow color on the text inputs and the submit button animation on hover; the transitions make the form look complete.

Although everything looks good, let's add some more goodies before we call it a day.


Step 6: Adding Labels

To make sure our form is properly accessible, add this bit of markup next to your input tags:

1
<label for="username">username</label>
2
<label for="password">password</label>

Because we want to make our form as simple as possible, we decided to use the placeholder attribute. Another way that also could have worked would be adding in a label tag. Because we don't need the tag in our design, rather for accessibility and SEO purposes, we will add this CSS code in:

1
#slick-login label {
2
	display: none;
3
}

Setting the display property to none achieves the look we want, which in this case, is no look at all!


Step 7: Cross-Browser Compatibility

Now, let's go back to that potential problem we would have with the placeholder attribute. Say someone is viewing this website from a browser that does not support placeholder: our blank inputs would be pretty unhelpful. To fix this, we will use jQuery and Modernizr to detect support and rectify situations where ther is none. To get started, let's link the scripts to our HTML page.

Drop the script tags in the <head> of your HTML. For best performance, you should have them follow after your stylesheet references. The reason we recommend placing Modernizr in the head is two-fold: the HTML5 Shiv (that enables HTML5 elements in IE) must execute before the <body> - Modernizr

1
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
2
<script src="http://www.modernizr.com/downloads/modernizr-latest.js"></script>

Now, create a new javascript file called placeholder.js. Unique Method has a great way of using Modernizr to create a fallback for the placeholder attribute. Add this code into the javascript file:

1
$(function()
2
{
3
    // check placeholder browser support

4
    if (!Modernizr.input.placeholder)
5
    {
6
         // set placeholder values

7
        $(this).find('[placeholder]').each(function()
8
        {
9
            if ($(this).val() == '') // if field is empty

10
            {
11
                $(this).val( $(this).attr('placeholder') );
12
            }
13
        });
14
         // focus and blur of placeholders

15
        $('[placeholder]').focus(function()
16
        {
17
            if ($(this).val() == $(this).attr('placeholder'))
18
            {
19
                $(this).val('');
20
                $(this).removeClass('placeholder');
21
            }
22
        }).blur(function()
23
        {
24
            if ($(this).val() == '' || $(this).val() == $(this).attr('placeholder'))
25
            {
26
                $(this).val($(this).attr('placeholder'));
27
                $(this).addClass('placeholder');
28
            }
29
        });
30
         // remove placeholders on submit

31
        $('[placeholder]').closest('form').submit(function()
32
        {
33
            $(this).find('[placeholder]').each(function()
34
            {
35
                if ($(this).val() == $(this).attr('placeholder'))
36
                {
37
                    $(this).val('');
38
                }
39
            })
40
        });
41
     }
42
});

We will also link the javascript file to our HTML page:

1
<script type="text/javascript" src="placeholder.js"></script>

In order to make this work, we need to add a placeholder class to the field inputs:

1
<input type="text" name="username" class="placeholder" placeholder="me@tutsplus.com">
2
<input type="password" name="password" class="placeholder" placeholder="password">

Now, let's add the styling for the placeholder class in our CSS file:

1
.placeholder {
2
    color: #444;
3
}

While we're at it, let's also add a helpful snippet of CSS that will make sure the widths of the inputs stay the same, regardless of the padding and borders:

1
* { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; }

For more information as to why box-sizing is so great, Paul Irish has a great explanation.


Step 8: Adding a Simple Animation

To make our form even more fancy, we will add a simple rising animation to the form when the page loads. Let's start off with declaring the animation and adding keyframes:

1
@keyframes "login" {
2
 0% {
3
    -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
4
   	filter: alpha(opacity=0);
5
   	opacity: 0;
6
   	margin-top: -50px;
7
 }
8
 100% {
9
    -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
10
   	filter: alpha(opacity=100);
11
   	opacity: 1;
12
   	margin-top: -75px;
13
 }
14
15
}
16
17
@-moz-keyframes login {
18
 0% {
19
   filter: alpha(opacity=0);
20
   opacity: 0;
21
   margin-top: -50px;
22
 }
23
 100% {
24
   filter: alpha(opacity=100);
25
   opacity: 1;
26
   margin-top: -75px;
27
 }
28
29
}
30
31
@-webkit-keyframes "login" {
32
 0% {
33
   filter: alpha(opacity=0);
34
   opacity: 0;
35
   margin-top: -50px;
36
 }
37
 100% {
38
   filter: alpha(opacity=100);
39
   opacity: 1;
40
   margin-top: -75px;
41
 }
42
43
}
44
45
@-ms-keyframes "login" {
46
 0% {
47
   -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
48
   filter: alpha(opacity=0);
49
   opacity: 0;
50
   margin-top: -50px;
51
 }
52
 100% {
53
   -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
54
   filter: alpha(opacity=100);
55
   opacity: 1;
56
   margin-top: -75px;
57
 }
58
59
}
60
61
@-o-keyframes "login" {
62
 0% {
63
   filter: alpha(opacity=0);
64
   opacity: 0;
65
   margin-top: -50px;
66
 }
67
 100% {
68
   filter: alpha(opacity=100);
69
   opacity: 1;
70
   margin-top: -75px;
71
 }
72
73
}

The CSS above declares a new animation called login and alters the margin-top and opacity values so that the form fades in and rises into position. Now, let's add in the CSS for the slick-login id:

1
	-webkit-animation: login 1s ease-in-out;
2
	-moz-animation: login 1s ease-in-out;
3
	-ms-animation: login 1s ease-in-out;
4
	-o-animation: login 1s ease-in-out;
5
	animation: login 1s ease-in-out;

Now, every time the page loads, the one second animation will execute. Now that we have styled, fixed and animated, we are done!


Final HTML and CSS

Here's a look at the final HTML for this slick login form:

1
<!DOCTYPE html>
2
<html lang="en">
3
4
<head>
5
	<meta charset="utf-8">
6
	<title>Slick Login</title>
7
	<meta name="description" content="slick Login">
8
	<meta name="author" content="Webdesigntuts+">
9
	<link rel="stylesheet" type="text/css" href="style.css" />
10
	<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
11
	<script src="http://www.modernizr.com/downloads/modernizr-latest.js"></script>
12
	<script type="text/javascript" src="placeholder.js"></script>
13
</head>
14
15
<body>
16
	<form id="slick-login">
17
		<label for="username">username</label><input type="text" name="username" class="placeholder" placeholder="me@tutsplus.com">
18
		<label for="password">password</label><input type="password" name="password" class="placeholder" placeholder="password">
19
		<input type="submit" value="Log In">
20
	</form>
21
</body>
22
23
</html>

And the CSS:

1
/*

2
CSS RESET

3
http://meyerweb.com/eric/tools/css/reset/

4
v2.0 | 20110126

5
License:  none (public domain)

6
 */
7
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video {
8
	margin: 0;
9
	padding: 0;
10
	border: 0;
11
	font-size: 100%;
12
	font: inherit;
13
	vertical-align: baseline;
14
}
15
16
/* HTML5 display-role reset for older browsers */
17
article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section {
18
	display: block;
19
}
20
21
body {
22
	line-height: 1;
23
}
24
25
ol,ul {
26
	list-style: none;
27
}
28
29
blockquote,q {
30
	quotes: none;
31
}
32
33
blockquote:before,blockquote:after,q:before,q:after {
34
	content: '';
35
	content: none;
36
}
37
38
table {
39
	border-collapse: collapse;
40
	border-spacing: 0;
41
}
42
43
/* CSS Animations */
44
@keyframes "login" {
45
 0% {
46
    -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
47
   	filter: alpha(opacity=0);
48
   	opacity: 0;
49
   	margin-top: -50px;
50
 }
51
 100% {
52
    -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
53
   	filter: alpha(opacity=100);
54
   	opacity: 1;
55
   	margin-top: -75px;
56
 }
57
58
}
59
60
@-moz-keyframes login {
61
 0% {
62
   filter: alpha(opacity=0);
63
   opacity: 0;
64
   margin-top: -50px;
65
 }
66
 100% {
67
   filter: alpha(opacity=100);
68
   opacity: 1;
69
   margin-top: -75px;
70
 }
71
72
}
73
74
@-webkit-keyframes "login" {
75
 0% {
76
   filter: alpha(opacity=0);
77
   opacity: 0;
78
   margin-top: -50px;
79
 }
80
 100% {
81
   filter: alpha(opacity=100);
82
   opacity: 1;
83
   margin-top: -75px;
84
 }
85
86
}
87
88
@-ms-keyframes "login" {
89
 0% {
90
   -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
91
   filter: alpha(opacity=0);
92
   opacity: 0;
93
   margin-top: -50px;
94
 }
95
 100% {
96
   -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
97
   filter: alpha(opacity=100);
98
   opacity: 1;
99
   margin-top: -75px;
100
 }
101
102
}
103
104
@-o-keyframes "login" {
105
 0% {
106
   filter: alpha(opacity=0);
107
   opacity: 0;
108
   margin-top: -50px;
109
 }
110
 100% {
111
   filter: alpha(opacity=100);
112
   opacity: 1;
113
   margin-top: -75px;
114
 }
115
116
}
117
118
/* Main CSS */
119
* { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; }
120
121
body {
122
	font-family: sans-serif;
123
	
124
	background-color: #323B55;
125
	background-image: -webkit-linear-gradient(bottom, #323B55 0%, #424F71 100%);
126
	background-image: -moz-linear-gradient(bottom, #323B55 0%, #424F71 100%);
127
	background-image: -o-linear-gradient(bottom, #323B55 0%, #424F71 100%);
128
	background-image: -ms-linear-gradient(bottom, #323B55 0%, #424F71 100%);
129
	background-image: linear-gradient(bottom, #323B55 0%, #424F71 100%);
130
}
131
132
#slick-login {
133
	width: 220px;
134
	height: 155px;
135
	position: absolute;
136
	left: 50%;
137
	top: 50%;
138
	margin-left: -110px;
139
	margin-top: -75px;
140
141
	-webkit-animation: login 1s ease-in-out;
142
	-moz-animation: login 1s ease-in-out;
143
	-ms-animation: login 1s ease-in-out;
144
	-o-animation: login 1s ease-in-out;
145
	animation: login 1s ease-in-out;
146
}
147
148
#slick-login label {
149
	display: none;
150
}
151
152
.placeholder {
153
    color: #444;
154
}
155
156
#slick-login input[type="text"],#slick-login input[type="password"] {
157
	width: 100%;
158
	height: 40px;
159
	positon: relative;
160
	margin-top: 7px;
161
	font-size: 14px;
162
	color: #444;
163
	outline: none;
164
	border: 1px solid rgba(0, 0, 0, .49);
165
166
	padding-left: 20px;
167
	
168
	-webkit-background-clip: padding-box;
169
	-moz-background-clip: padding-box;
170
	background-clip: padding-box;
171
	border-radius: 6px;
172
173
	background-image: -webkit-linear-gradient(bottom, #FFFFFF 0%, #F2F2F2 100%);
174
	background-image: -moz-linear-gradient(bottom, #FFFFFF 0%, #F2F2F2 100%);
175
	background-image: -o-linear-gradient(bottom, #FFFFFF 0%, #F2F2F2 100%);
176
	background-image: -ms-linear-gradient(bottom, #FFFFFF 0%, #F2F2F2 100%);
177
	background-image: linear-gradient(bottom, #FFFFFF 0%, #F2F2F2 100%);
178
179
	-webkit-box-shadow: inset 0px 2px 0px #d9d9d9;
180
	box-shadow: inset 0px 2px 0px #d9d9d9;
181
182
	-webkit-transition: all .1s ease-in-out;
183
	-moz-transition: all .1s ease-in-out;
184
	-o-transition: all .1s ease-in-out;
185
	-ms-transition: all .1s ease-in-out;
186
	transition: all .1s ease-in-out;
187
}
188
189
#slick-login input[type="text"]:focus,#slick-login input[type="password"]:focus {
190
	-webkit-box-shadow: inset 0px 2px 0px #a7a7a7;
191
	box-shadow: inset 0px 2px 0px #a7a7a7;
192
}
193
194
#slick-login input:first-child {
195
	margin-top: 0px;
196
}
197
198
#slick-login input[type="submit"] {
199
	width: 100%;
200
	height: 50px;
201
	margin-top: 7px;
202
	color: #fff;
203
	font-size: 18px;
204
	font-weight: bold;
205
	text-shadow: 0px -1px 0px #5b6ddc;
206
	outline: none;
207
	border: 1px solid rgba(0, 0, 0, .49);
208
209
	-webkit-background-clip: padding-box;
210
	-moz-background-clip: padding-box;
211
	background-clip: padding-box;
212
	border-radius: 6px;
213
214
	background-color: #5466da;
215
	background-image: -webkit-linear-gradient(bottom, #5466da 0%, #768ee4 100%);
216
	background-image: -moz-linear-gradient(bottom, #5466da 0%, #768ee4 100%);
217
	background-image: -o-linear-gradient(bottom, #5466da 0%, #768ee4 100%);
218
	background-image: -ms-linear-gradient(bottom, #5466da 0%, #768ee4 100%);
219
	background-image: linear-gradient(bottom, #5466da 0%, #768ee4 100%);
220
	
221
	-webkit-box-shadow: inset 0px 1px 0px #9ab1ec;
222
	box-shadow: inset 0px 1px 0px #9ab1ec;
223
	
224
	cursor: pointer;
225
226
	-webkit-transition: all .1s ease-in-out;
227
	-moz-transition: all .1s ease-in-out;
228
	-o-transition: all .1s ease-in-out;
229
	-ms-transition: all .1s ease-in-out;
230
	transition: all .1s ease-in-out;
231
}
232
233
#slick-login input[type="submit"]:hover {
234
	background-color: #5f73e9;
235
	background-image: -webkit-linear-gradient(bottom, #5f73e9 0%, #859bef 100%);
236
	background-image: -moz-linear-gradient(bottom, #5f73e9 0%, #859bef 100%);
237
	background-image: -o-linear-gradient(bottom, #5f73e9 0%, #859bef 100%);
238
	background-image: -ms-linear-gradient(bottom, #5f73e9 0%, #859bef 100%);
239
	background-image: linear-gradient(bottom, #5f73e9 0%, #859bef 100%);
240
241
	-webkit-box-shadow: inset 0px 1px 0px #aab9f4;
242
	box-shadow: inset 0px 1px 0px #aab9f4;
243
	margin-top: 10px;
244
}
245
246
#slick-login input[type="submit"]:active {
247
	background-color: #7588e1;
248
	background-image: -webkit-linear-gradient(bottom, #7588e1 0%, #7184df 100%);
249
	background-image: -moz-linear-gradient(bottom, #7588e1 0%, #7184df 100%);
250
	background-image: -o-linear-gradient(bottom, #7588e1 0%, #7184df 100%);
251
	background-image: -ms-linear-gradient(bottom, #7588e1 0%, #7184df 100%);
252
	background-image: linear-gradient(bottom, #7588e1 0%, #7184df 100%);
253
254
	-webkit-box-shadow: inset 0px 1px 0px #93a9e9;
255
	box-shadow: inset 0px 1px 0px #93a9e9;
256
}


Conclusion

Here's a glimpse at the final result:

The great thing about this form is that it's very easy to change. It's also very easy to extend, add more inputs, validation, functionality etc. Thanks for reading along and I hope you learned something. I'll be interested to hear what you use this for!

Advertisement
Did you find this post useful?
Want a weekly email summary?
Subscribe below and we’ll send you a weekly email summary of all new Web Design tutorials. Never miss out on learning about the next big thing.
Advertisement
Looking for something to help kick start your next project?
Envato Market has a range of items for sale to help get you started.