CSS3 signup form

If you’re about to launch a new web product or you just need to improve the user experience for an existing web form, then this tutorial is for you.

In this article you’ll find out how to design a clean and attractive CSS3 signup form.

View demo

In the past, I have designed some sign in forms, but never a signup form. So, to get the job completely done, I decided to write this article.

The HTML

Here’s how the markup looks like for this signup form:

<form id="signup">
	<h1>Start doing cool stuff in seconds.</h1>
	<input type="email" placeholder="john.doe@email.com" required="">
	<input type="password" placeholder="Choose your password" required="">
	<input type="password" placeholder="Confirm password" required="">					
	<button type="submit">Sign up for free!</button>	
</form>

For this example, I decided to use a buttton instead of the classic input type="submit". This way, further, it will be a lot easier to target the form’s elements (without adding any id’s or classes).

Placeholder polyfill

You can easily notice the new HTML5 stuff like type="email", placeholder or required. For the placeholder attribute, we’ll add a HTML5 polyfill that will simulate its effect for older browsers.

In this example, we’ll be using Mathias Bynens‘s Placeholder jQuery plugin. That’s a very cool one and it’s highly recommended.

The CSS

As usual, I’ll list below the styles used for this example. Prefixed properties are missing here, but you can find them in the demo page source.

Form styles

After I created a simple 3x4 image pattern, I converted it into a base64 string. To do that, I used this wonderful Image to Base64 Converter tool. You can see it in the styles as a background for #signup.

Regarding the paper stack effect, this time we’re using the ::before and ::after pseudo-elements to do that. Here‘s one of my previous articles where I used a similar technique.

#signup {
	width: 550px;
	height: 330px;
	margin: 100px auto 50px auto;
	padding: 20px;
	position: relative;
	background: #fff url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAECAMAAAB883U1AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAlQTFRF7+/v7u7u////REBVnAAAAAN0Uk5T//8A18oNQQAAABZJREFUeNpiYGJiYmBiYgRiBhAGCDAAALsAFJhiJ+UAAAAASUVORK5CYII=);
	border: 1px solid #ccc;
	border-radius: 3px;  
}

#signup::before, 
#signup::after {
	content: "";
	position: absolute;
	bottom: -3px;
	left: 2px;
	right: 2px;
	top: 0;
	z-index: -1;
	background: #fff;
	border: 1px solid #ccc;			
}

#signup::after {
	left: 4px;
	right: 4px;
	bottom: -5px;
	z-index: -2;
	box-shadow: 0 8px 8px -5px rgba(0,0,0,.3);
}

Heading

I tried to create a nice and abstract design for the form’s heading, so here’s my result:

#signup h1 {
	position: relative;
	font: italic 1em/3.5em 'trebuchet MS',Arial, Helvetica;
	color: #999;
	text-align: center;
	margin: 0 0 20px;
}

#signup h1::before,
#signup h1::after{
	content:'';
	position: absolute;
	border: 1px solid rgba(0,0,0,.15);
	top: 10px;
	bottom: 10px;
	left: 0;
	right: 0;
}

#signup h1::after{
	top: 0;
	bottom: 0;
	left: 10px;
	right: 10px;
}

Using pseudo-elements (again) :)

Form elements

Not so much to say here. For the submit button, please notice the gradient transition workaround.

::-webkit-input-placeholder {
   color: #bbb;
}

:-moz-placeholder {
   color: #bbb;
} 				    	

.placeholder{
	color: #bbb; /* polyfill */
}		

#signup input{
	margin: 5px 0;
	padding: 15px;
	width: 100%;
	*width: 518px; /* IE7 and below */
	box-sizing: border-box;
	border: 1px solid #ccc;
	border-radius: 3px;	
}

#signup input:focus{
        outline: 0;
        border-color: #aaa;
	box-shadow: 0 2px 1px rgba(0, 0, 0, .3) inset;
}		

#signup button{
	margin: 20px 0 0 0;
	padding: 15px 8px;			
	width: 100%;
	cursor: pointer;
	border: 1px solid #2493FF;
	overflow: visible;
	display: inline-block;
	color: #fff;
	font: bold 1.4em arial, helvetica;
	text-shadow: 0 -1px 0 rgba(0,0,0,.4);		  
	background-color: #2493ff;
	background-image: linear-gradient(top, rgba(255,255,255,.5), rgba(255,255,255,0)); 
	transition: background-color .2s ease-out;
	border-radius: 3px;
	box-shadow: 0 2px 1px rgba(0, 0, 0, .3), 0 1px 0 rgba(255, 255, 255, .5) inset;		  						  
}

#signup button:hover{
  	background-color: #7cbfff;
        border-color: #7cbfff;
}

#signup button:active{
	position: relative;
	top: 3px;
	text-shadow: none;
	box-shadow: 0 1px 0 rgba(255, 255, 255, .3) inset;
}

That’s it!

View demo

I’m aware that this example does not contain revolutionary techniques, but neither shouldn’t. The possibilities are endless when it comes about web forms styling, as long as you follow up the best and recommended practices.

This is just another cool example created using CSS3′s great power. I hope you will find it useful for your projects, and please don’t forget to leave a comment if you liked it (or not). :)

26 thoughts on “CSS3 signup form

  1. Catalin, you write
    “I’m aware that this example does not contain revolutionary techniques, but neither shouldn’t”, but also the wheel was not invented yesterday, but was found and will find all the new use!
    The possibilities CSS3 are almost endless!
    Thank you for your work.
    As always, strong and very useful work!

    Catherine Khetagurova.

  2. This tutorial helps me have more knowleague about converting images into a base64string. It’s so great. “Cám ơn rất nhiều” – English means: Thanks you so much! :D

    • Hey red, i have a question, why do you use base24 string replace images? base24 string load faster than images? ?_?

      • I guess you mean “base64″. :)

        For this example, I used it just to save a HTTP request. Also, this way I didn’t need to use extra image for that background.

        PS. I’ve removed your other comments, please contact me if you have other questions.

  3. This site is just awesome. Recently discovered it and bookmarked it right away. Frequently checking for updates. Keep up the good work.

  4. Dear Sir,
    Earlier I was using Kontera for “Contact Me” form.
    But that site went off since 2-3 weeks so I did a makeshift arrangement by tweaking feedburner’s “Email Me” example

    http://feedburner.google.com/fb/a/emailFlare?to=demo@gmail.com&itemTitle=Mrunal&uri=http%3A%2F%2Fmrunal-exam.blogspot.com%2F2012%2F03%2Feconomy-reliance-kg-basin-issue-reason.html

    So How do I implement beautiful design this on feedburner contact page.
    Is there a way by modifying something under ?

  5. Dear Sir,
    First of all thanks for your beautiful explanations and demos of CSS.
    Your earlier posts on horizontal navigation menu and ordered-list-styles were terrific and awesome.
    I made slight modification in your Ordered-list-styles and created a verticle navigation menu with rotational effect and implemented it in my blog, check them out

    http://mrunal-exam.blogspot.in/

    I request you to upload more a tutorial on verticle navigational menu (with menu and sub-menus features).
    like this one : http://www.red-team-design.com/css3-dropdown-menu
    but on vertical format.

    I’ll be really grateful. Thanks in advance.
    Have a great week,
    Mrunal Patel.

    • I’m not sure about your question, but you can check the demo’s page source. Then, you just need to Copy & Paste!

      Good luck! ;)

  6. You always do great stuff. But you know, I have this kind of implementation but when I put it before a user and he asked a question, if the form has say 6 fields, if he has filled one and he needs to change the content he entered, there’s no way of knowing what the field was supposed to contain. Say for example, he has a field that says car color has the placeholder, and he filled in brown now he looks at brown and he does not remember what the brown was for. Don’t you think it would be a great idea to have a hint to remind him whenever he forgets?

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>