Good Form, Jack - You Gotta Have Class
(Page 2 of 5 )
Humans have a funny tendency to enjoy an aesthetically pleasing environment. We acknowledge this when we put a great deal of effort into designing a fancy Flash splash intro for our web site and spend hours tweaking the global style sheet. So then how could we forget about forms, leaving them to their default, boring look? Yes, if we type in <input type=”text” />, we should get something that looks like this:

Now, I say 'should', because the rendering depends entirely on the client at this point. Yes, different browsers and even different operating systems will render the default input field how they see fit, or at least how their designers see fit. That's no good.
So when you're defining your global style sheets, don't leave out your input tags. You can create one style by defining the input tag style, but what I prefer to do is divide them out by type. I might create a class called input.textbox, and for text fields set the class=”textbox”. Generally I would redefine the default border and text family. Try this style on for size:
input.textbox {
font-family: Verdana, Geneva;
font-size: 8pt;
color:#333333;
border: 1px solid #666666;
height: 18px;
}
You'll find that this renders a much more crisp input box, that is consistent across your website. By the way, don't leave the size of the field up to the browser to determine. It is always a good idea to set the size attribute of an input field, but an even better idea to hard-code the width in pixels.
Next: Getting a Little Fancy >>
More HTML Articles
More By Justin Cook