Three Styles

Tutorials and Resources for Web Designers

  • Home
  • Tutorials
  • Free Stuff
  • About Me
  • Contact

Subscribe:   RSS  |  Email  | Twitter

Create a Slick CSS3 Login Form NO IMAGES ALLOWED

26

by Shane Jeffers

Create a Slick CSS3 Login Form NO IMAGES ALLOWED

The goal of this post is to harness some new functionality provided by CSS3 and move away from images. We are going to create a CSS3 login form without images yet still have a visually pleasing result.


DEMO

Writing the HTML

First lets begin with creating the HTML markup that makes up the login form. Start with the basic HTML page as I will not include that portion in the code.

<form>
		<label>Username:</label>
			<input type="text" name="username" />
		<label>Password:</label>
			<input type="password" name="password"  />
			<input type="submit" value="Submit" name="submit" class="submit" />
</form>

This is the basic markup with a few labels and Input elements. Now there are many different ways to markup the HTML you see above, but I tried to make it as simple as possible. Make sure you add the Class SUBMIT to your button because it will require different styling.

HTML Only Demo

CSS3 Login Form Tutorial

As you can see above we really need the power of CSS in order to give this login form some visual appeal. Enter CSS3!

Writing the CSS

It is now time to give this login form some life. CSS3 has some really powerful new features and we will be covering only a few of them. First lets get some of the basic layout styles down nothing having to do with CSS3

Styling the Form Element

We will begin writing our CSS targeting the form element as some of the other elements on the page will rely on the parent element. I’m going to go through the properties in logical order not in alphabetical order. We want to set the width to 250px with 20px of padding on all sides and a 1px border also.

form {
    width: 250px;
    padding: 20px;
    border: 1px solid #270644;
}

Adding CSS3 to the Form Element

Now lets add in the CSS3 magic to bring this form to life.

form {
    width: 250px;
    padding: 20px;
    border: 1px solid #270644;

    /*** Adding in CSS3 ***/

    /*** Rounded Corners ***/
    -moz-border-radius: 20px;
    -webkit-border-radius: 20px;

    /*** Background Gradient - 2 declarations one for Firefox and one for Webkit ***/
    background:  -moz-linear-gradient(19% 75% 90deg,#4E0085, #963AD6);
    background:-webkit-gradient(linear, 0% 0%, 0% 100%, from(#963AD6), to(#4E0085));

    /*** Shadow behind the box ***/
    -moz-box-shadow:0px -5px 300px #270644;
    -webkit-box-shadow:0px -5px 300px #270644;
}

Styling the Input Elements

Styling the input elements is pretty easy but it does have some complications that can frustrate. We will apply a background color, a top border, some padding, and a width.

input {
    width: 230px;
    background: #8a33c6;
    padding: 6px;
    margin-bottom: 10px;
    border-top: 1px solid #ad64e0;
    border-left: 0px;
    border-right: 0px;
    border-bottom: 0px;
}

Adding CSS3 to the Input Element

For the input element we will implement the new features of CSS3 called transitions. Unfortunately this only works in Webkit browsers such as Safari and Chrome.

input {
    width: 230px;
    background: #8a33c6;
    padding: 6px;
    margin-bottom: 10px;
    border-top: 1px solid #ad64e0;
    border-left: 0px;
    border-right: 0px;
    border-bottom: 0px;

    /*** Adding CSS3 ***/

    /*** Transition Selectors - What properties to animate and how long ***/
    -webkit-transition-property: -webkit-box-shadow, background;
    -webkit-transition-duration: 0.25s;

    /*** Adding a small shadow ***/
    -moz-box-shadow: 0px 0px 2px #000;
    -webkit-box-shadow: 0px 0px 2px #000;
}

Now that we have the styles for the inputs in place lets style the hover events for those same inputs.

input:hover {
    -webkit-box-shadow: 0px 0px 4px #000;
    background: #9d39e1;
}

Some of you may not have caught it but I increased the radius of the shadow on hover from 2px to 4px. That is why we used the transition effects on the inputs because it triggers that change on hover.

Styling the Button

Ok we’re almost done, on to the button! Since we gave our button the class SUBMIT we can use that selector in our CSS.

input.submit {
    width: 100px;
    color: #fff;
    text-transform: uppercase;
    text-shadow: #000 1px 1px;
    border-top: 1px solid #ad64e0;
    margin-top: 10px;
}

Adding CSS3 to the Submit Button

input.submit {
    width: 100px;
    color: #fff;
    text-transform: uppercase;
    text-shadow: #000 1px 1px;
    border-top: 1px solid #ad64e0;
    margin-top: 10px;

    /*** Adding CSS3 Gradients ***/
    background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#963AD6), to(#781bb9));
    background:  -moz-linear-gradient(19% 75% 90deg,#781bb9, #963AD6);
}

That’s it! Now you have an awesome login form styled strictly with CSS3 and no images. Of course it only works in webkit browsers currently which are Safari and Chrome, but CSS3 support will be coming to a browser near you soon. If you liked this post please promote it below!

FINAL DEMO

Written by Shane Jeffers

Shane Jeffers is the Creator and Author of Three Styles. I have a unique passion for design trends and tutorials. Follow me on twitter @ThreeStyles

Enjoy this post? Subscribe by RSS or Email

Related posts:

  1. Create Apple’s Navigation Bar in Photoshop from Scratch
  2. Design and Code a Sweet Custom Coming Soon Page

CSS, Tutorials

26 Responses to “Create a Slick CSS3 Login Form NO IMAGES ALLOWED”

  1. GravatarDwayne Paisley-Marshall Says:
    May 10th, 2010 at 12:57 pm

    This is so awesome, simple but creative.

  2. GravatarIsrael Leichtman Says:
    May 10th, 2010 at 4:12 pm

    Thanks, I’m just beginning to learn CSS3. It is so powerful!

  3. GravatarTony Says:
    May 10th, 2010 at 11:49 pm

    Gradients make my head hurt.
    Tony´s last blog ..WordCamp SF 2010: The Only Recap That Matters My ComLuv Profile

  4. GravatarAbdullah Al Mamun Says:
    May 11th, 2010 at 1:59 am

    Simply elegant……. thanks a lot for share :-)

  5. GravatarWebstandard-Blog Says:
    May 11th, 2010 at 7:46 am

    Very nice, but for a better conversionrate I would design the submit-button in different colors that the other form-elements.
    Webstandard-Blog´s last blog ..Ladezeit von Webseiten verbessern – Bilder mit Dateikomprimierung optimieren My ComLuv Profile

  6. GravatarJeremy Says:
    May 12th, 2010 at 9:51 am

    Nice one! I did one too! http://bbxdesign.com/wp-content/uploads/html/formulaire-css3.html

  7. GravatarHassan Raza Says:
    May 18th, 2010 at 10:37 am

    It is awesome in Chrome, in safari it is good. in Firefox and opera transition effect is not working that much good so average in that.. and In IE …………. you people know what it is.

  8. GravatarValentine Says:
    May 23rd, 2010 at 5:59 am

    Very nice, but you did forgot 1 thing:
    Whenever you do something with CSS3 you should use not only browser specific (-webkit, -moz) declarations, but also standart CSS3 declarations like border-radius (http://www.w3.org/TR/css3-background/#the-border-radius) and box-shadow (it has been removed from CSS3, but in my opinion you should use it anyway, i think Opera and some other browsers are implementing this)

    CSS3 has nothing on gradients, but there is IE filter which could do the trick in IE: filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=’#f88e11′, endColorstr=’#f06015′);

  9. GravatarAshfaq Says:
    May 24th, 2010 at 10:27 am

    Excellent article…Thanks to you and comments from Valentine too..If you get time please, update this with non css3 supported browser also.

    Thanks
    Ashfaq

  10. GravatarValentine Says:
    May 24th, 2010 at 3:45 pm

    Ashfaq, there’s no point to implement this for non-CSS3 browsers. Graceful degradation is what you should look for. That means IE user will get square corners instead of rounded and regular background instead of gradient. But it’s still good and beatufilul check it out yourself with IE. And it’s a good practice!

  11. GravatarAafrin Says:
    May 25th, 2010 at 10:28 am

    Awesome Post, Very Detailed Explanation On CSS3 Styling… Thanks
    Aafrin´s last blog ..A Noob’s Guide To Set Yii Php Framework In Windows Environment – Part 2 My ComLuv Profile

  12. GravatarSivaranjan Says:
    May 28th, 2010 at 8:45 am

    Whoa! I didnt know I could do this much with CSS and HTML! Thanks for writting such an amazing piece of tutorial. I am gonna need this. Can I add this article to my CSS aggregator site ?

  13. Gravatarndasgodhog Says:
    October 6th, 2010 at 8:15 am

    thank you for the tutorial…

    I’ll use this tutorial for the essential of my programs…

  14. GravatarLachlan Says:
    October 24th, 2010 at 9:26 am

    You can get rid of the background bleed at the bottom of the rounded corners with:

    background-clip: padding-box;
    or
    -webkit-background-clip: padding;
    -moz-background-clip: padding;

    Note that the vendor prefixed properties have no “-box” at the end.

    Source:
    http://stackoverflow.com/questions/2394249/parts-of-background-image-visible-when-using-border-radius

    https://developer.mozilla.org/en/CSS/background-clip#Browser_compatibility
    Lachlan´s last blog ..YouTube Downloader Bookmarklet Update v21 My ComLuv Profile

  15. GravatarIE8/IE9??? Says:
    November 22nd, 2010 at 10:54 am

    It does work in Google Chrome but not in IE8 and IE9 Beta

  16. GravatarAmr Boghdady Says:
    November 23rd, 2010 at 9:02 pm

    I’ve tried it as well, it works fine on Firefox, but not with IE 7 :(
    Amr Boghdady´s last blog ..Deutschedcom Launched ! My ComLuv Profile

  17. GravatarDarren Says:
    December 10th, 2010 at 8:48 pm

    This is the most awesome tutorial I’ve ever found. Nice work man.

  18. GravatarKdniazi Says:
    December 29th, 2010 at 6:07 am

    Great butt not supported less versions of ie and firefox

  19. GravatarBBT Says:
    February 16th, 2011 at 9:05 am

    this form is beautiful!

  20. GravatarRoscoe Says:
    March 3rd, 2011 at 6:38 am

    Hey Shane,

    Where did you originally learn your CSS3 skills? You do some killer stuff. I’m struggling to get going myself. Thanks!

  21. Gravatarwptidbits Says:
    April 19th, 2011 at 6:41 am

    Great! Yeah i manage to do this myself, but never doubt your coding format and color combinations look better. Do continue posts like this again. Thanks!

  22. Gravatarfarzad Says:
    April 27th, 2011 at 12:11 pm

    Hi
    Thanks a lot.

    very beauty FORM.

    I use it in our site.

  23. GravatarFernando Lee Says:
    July 12th, 2011 at 8:59 pm

    amazing tutorial and work ! thank you

  24. Gravatarprinter ink Says:
    August 3rd, 2011 at 12:53 pm

    If you have ever seen the new twitter.com login form you can see this cool effect. This is a good tutorial trying to recreate that style form. The markup is simple enough.

  25. GravatarKyle Says:
    August 23rd, 2011 at 11:09 pm

    Great stuff! For too long the web has been tainted with ugly forms!

  26. GravatarNova Says:
    September 16th, 2011 at 1:17 am

    Hi shane!! your the master of tutorial!! love it! thanks for sharing!
    Nova´s last blog ..Inexpensive Car InsuranceMy ComLuv Profile

Leave a Reply

Click here to cancel reply.

CommentLuv Enabledshow more

2293
1356

Sponsors

Christian T-Shirt Design Contest

Polls

  • What's your favorite iPhone 4 feature?

    View Results

    Loading ... Loading ...

Popular

  • HTML5 Rocks My Socks Off 74 comments
  • Coding Apple's Navigation Bar Using CSS Sprites 68 comments
  • The Ultimate Guide to CSS Typography 55 comments
  • 10 Popular Design Blogs and How They'd Smell 49 comments
  • Three Styles Half Birthday Giveaway! 38 comments
  • CSS Drop Down Navigation Tutorial 34 comments
  • 20 Funny Apple Product Knock-Offs 34 comments

Topics

  • Apple Stuff
  • Blogs
  • CSS
  • Drupal
  • Free Stuff
  • Icons
  • Photoshop
  • Tips
  • Tutorials

Other Resources

  • AddToDesign
  • Circle Box Blog
  • Blog.Spoon Graphics
  • Design Bump
  • Naldz Graphics
  • NETTUTS
  • Noupe
  • Pixel Clouds
  • PSDFAN.COM
  • PSDVIBE
  • Six Revisions
  • Smashing Magazine
  • Visual Swirl
  • Webdesigner Depot
  • Web Design Ledger
  • Christian T-shirts
  • Website Design Virginia

Latest Posts

  • The New iPhone 4 Will Change the Way We Communicate
  • Lets Get Inspired – Top 10 CSS Galleries of 2010
  • Create a Slick CSS3 Login Form NO IMAGES ALLOWED
  • Awesome 3D Facebook Social Media Icon Photoshop Tutorial
  • 15 Outstanding Drupal Modules You Should Be Using

Recent Comments

    1. Del@circulon-pans:This is a great tutorial on how to create a design for a blog. Sorry if you...
    2. Joseph Buarao:I like your post mate very informative.. thank so much for sharing this.. :...
    3. Behrouz:Hi Thanks for tutorial, but I have a question for you, as well. How we can...
    4. Shelly:I’ve read 2 different books on HTML5, and I’ve started reading a 3rd one, a...
    5. acoustic:Great css tutorial thank you for posting !........

Find us on

  • Twitter
  • Stumble Upon
  • Delicious
  • Design Bump
  • Digg

Copyright © 2010 Three Styles. All Rights Reserved. Web Design and Wordpress Development by Shane Jeffers

About   |   Contact   |   Our Feed