counter


Username:Password:
///////////////////////////////////

December 14, 2007

Style a login form

Filed under: Advanced Html — admin @ 9:11 am

The old way…

Login forms are pretty usual at web sites, but they are very often very bad looking… This is a good example on a standard way to do a login form. (Don’t worry, we will make this form look better soon…)


This is the HTML code for this form:
<form id=”login”><br />
Username: <input type=”text” name=”user” /><br />
Password: <input type=”password” name=”password” /><br />
<input type=”submit” value=”Submit” name=”Submit” /><br />
</form>
It doesn’t look that sexy, right?! :-(
And it often look like this when you login at sites…

We make it look better

A simple thing is to put the form on one row, like this:

What we did to create this is simply remove the <br> after the input’s.
Starting to look a little bit better, but still extremelly boring right…

What about a little color and stuff like this?

Nothing hard, but it directly looks so much better.
To do this, change the style sheet into this:
#login {
background-color: #DDDDDD;
color: #000000;
border: 1px solid #777777;
font-family: Verdana;
font-size: 10px;
text-align: right;
width: 440px;
margin: 2px;
}

This styles the form that we created, because it has id=”login”.
It should be pretty obvious what it does, so just read the stylesheet.

The next thing we do is style the inputs and the submit button with this style sheet:

#login .theInput {
font-family: Verdana;
font-size: 11px;
width: 110px;
margin-right: 5px;
}

#login .theSubmit {
font-family: Verdana;
font-size: 10px;
background-color: #333333;
color: #FFFFFF;
margin-right: 5px;
}

And make some small changes to the html, adding classes to the inputs and button:
<form id=”login”> Username: <input type=”text” class=”theInput” name=”user” />
Password: <input type=”password” class=”theInput” name=”password” />
<input type=”submit” name=”Submit” value=”Submit” />
</form>

The result looks like this:

It’s beautiful right :-)

There are so many more things you can do, but start playing around with this form and create your own designs. Small things like changing the standard text fonts and sizes make big differences. It directly looks more professional. You can also replace the submit button with an image for creating even more unique design.

Until next time… happy form-ing!


December 8, 2007

CSS image replacement for submit buttons

Filed under: Advanced Html — admin @ 11:40 pm

Expanding the techniques for CSS image replacement by Mike Rundle and Seamus P. H. Leahy, and inspired by a question posted to the WebDesign-L mailing list, I have developed an image replacement method for submit buttons, and in general for the button tag.

Using this method you’ll get a clickable image when style sheets are active, and a standard button when style sheets are off. The trick is to apply the image replace methods to a button tag and use it as the submit button, instead of using input. And since button borders are erased, it’s also recommendable change the button cursor to the hand shaped one used for links, since this provides a visual tip to the users.

Here you can see examples of both variants of this method using a basic Google search box. This works in all the browsers in which image replacement works: Firefox/Mozilla, IE 5/6, Opera 7/8, Konqueror 3.4 & Safari (thanks to Philippe Wittenbergh for the feedback about Mac browsers).

Using text-indent for image replacement: