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

36

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

CSS, Tutorials

  • http://www.lessismoredesigns.co.uk Dwayne Paisley-Marshall

    This is so awesome, simple but creative.

  • http://www.lnacomp.com Israel Leichtman

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

  • http://loneplacebo.com Tony

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

  • http://www.twitter.com/mamunabms Abdullah Al Mamun

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

  • http://webstandard.kulando.de Webstandard-Blog

    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 =-.

  • http://bbxdesign.com Jeremy

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

  • Hassan Raza

    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.

  • Valentine

    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′);

  • http://ashfaqasp.wordpress.com Ashfaq

    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

  • Valentine

    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!

  • http://www.aafrin.com Aafrin

    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 =-.

  • http://www.cssfind.com Sivaranjan

    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 ?

  • ndasgodhog

    thank you for the tutorial…

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

  • http://lachlanarthur.com Lachlan

    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 =-.

  • IE8/IE9???

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

  • http://www.deutsched.com Amr Boghdady

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

  • Darren

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

  • http://Nill Kdniazi

    Great butt not supported less versions of ie and firefox

  • http://bigboytable.com/ BBT

    this form is beautiful!

  • http://www.mobiledevicemanagement.org Roscoe

    Hey Shane,

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

  • http://wptidbits.com/ wptidbits

    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!

  • http://www.agah-iran.com farzad

    Hi
    Thanks a lot.

    very beauty FORM.

    I use it in our site.

  • Fernando Lee

    amazing tutorial and work ! thank you

  • http://www.toner2ink.com/ printer ink

    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.

  • http://www.creativebasement.com Kyle

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

  • Nova

    Hi shane!! your the master of tutorial!! love it! thanks for sharing!

  • http://www.crazy-list.de Norbert

    amazing tutorial and work ! Respect and thank you.

  • santhosh

    its very nice,,very helpful to design a form,thanks

  • Deepak

    This is a great post man thanks a lot you saved my lot of time to design a login page

  • Atik Khan

    Thanks, it is very help full for new web designer. This is my first comment . Thanks again.

  • http://www.prashantsani.com Prashant

    Its amazing how CSS3 brings amazing capabilities of using gradients,shadows thereby reducing our dependence on images. Amazing Article. For those looking out to support in old browsers that dont support CSS3, you can use Modernizr

  • Klaus Strauss

    Great work, your tutorial is awesome… But… I have only ONE question:

    How can I make a selected field to keep its hover color while I’m writing in it, and then change again to its initial color?

    I have tried with

    :current, :selected, :active, but it didnt’ work…

    can somebody help me with an answer pretty please? :)

  • http://sanca.web.id Sanca

    thanks for the tutorial. allow me to use your script…

    GOD Bless You.. ^_^

  • Rabin

    Thanks…it’s working.

  • LiRuiKe

    Awesome. Thanks!

  • http://entertainmentmesh.com/ Zavera Farid

    Amazing, love to create a login form with CSS3!

3214
1390

Sponsors

Christian T-Shirt Design Contest

Popular

  • Coding Apple's Navigation Bar Using CSS Sprites 78 comments
  • HTML5 Rocks My Socks Off 77 comments
  • The Ultimate Guide to CSS Typography 56 comments
  • CSS Drop Down Navigation Tutorial 51 comments
  • 10 Popular Design Blogs and How They'd Smell 50 comments
  • Three Styles Half Birthday Giveaway! 38 comments
  • 20 Funny Apple Product Knock-Offs 36 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
  • Fantasy Football Matchups

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. Rodriges Antonio:I found some more better then Sequel Pro tool - Valentina Studio, it works ...
    2. anon:WTF !!! CCK & Views not in your list ?...
    3. Zavera Farid:Amazing, love to create a login form with CSS3!...
    4. Vincent Churchil:How about Replicon's ...
    5. William RAHI:Great post! We’ll definitely be following some of these blogs into 2013. Th...

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