CSS Forms

CSS Forms – I found this article about creating css forms on generally a very informative website. It is pretty straight forward.

You have your LABEL tag and your INPUT tag. You give them both a width, display them as blocks and float them left. Add a bottom margin and clear the breaks you out between the lines and bobs you uncle.


label,input {
display: block;
width: 150px;
float: left;
margin-bottom: 10px;
}
label {
text-align: right
width: 75px;
padding-right:
20px;
}
br {
clear: left;
}

This is the same as what is on the quirksmode site. The problem with this is if you need to get your forms working in Netscape 6.2/7.0. This browser does not like the label tag at all. The way to fix this is put spans inside the label tags and replace the label css reference with a span.

You will probably find that your forms are never this tidy and you might have two input boxes next to each other on one line. To get around this I would set a special DIV that accounts for this and adjust widths etc accordingly. This goes for radio buttons and checkboxes too.

One last thing if you need to style forms differently within your site but a div around the whole form – this way you can set up a number of styles for your forms and switch them by changing the container div. This also avoids messing up any further span tags you might want use on the rest of the site.

Comments

Leave a Reply

Stuff I Dugg

  • Drivable Star Wars Landspeeder Kicks Ass

  • One Less Windows User

    After nearly five years, I needed to update my personal computer. My old Dell Inspiron has long since been rendered quaint by advances in processor speed and hard drive capacity. Rather than buy a new machine running Windows Vista or take the Mac plunge, I decided to walk the open source walk.

  • 20 Tech Habits to Improve Your Life

    A few new habits can make the difference between staying on task, finding what you need, and getting things done--or having a tech meltdown.

  • Space Cube - The World's Smallest Linux PC

    Meet the Space Cube — the world's smallest fully functional PC. Primarily designed for use in space, it somehow manages to cram a working PC with USB ports, card readers, audio outputs and proprietary interfaces into a tiny cube chassis measuring just two inches square. It runs a basic Linux front-end.

  • How Simple Web Design Helps Your Business

    It’s crucial to have simple web designs to allow the user to quickly find the information they need, especially if you are selling a product. If the page is cluttered with useless text, widgets or unrelated products, the site becomes meaningless.

  • 24 Core, 48GB Linux Render Cluster built inside IKEA Cabinet

    This amazing Linux Cluster consists of 6 Intel Core 2 Quad(2.4GHZ) Processors, 48GB of RAM spread across 6 GIGABYTE GA-G33M-DS2R Micro ATX motherboards and put inside an IKEA Helmer cabinet, WHY YOU ASK? 3D computer rendering is very CPU intensive and the best way so speed up slow render problems, are usually to distribute them on to more computers

  • 25 killer Linux apps

    The very best software for your Linux machine.

  • Lego Star Wars Olympics 2008 [Flickr Photo Set]

    Beijing 2008 Olympic Games

  • Leaked Document Shows Verizon's Anti-iPhone Propaganda

    Verizon's tactics to combat the Jesusphone 3G now include briefing its employees about the iPhone's failings, so they can answer customer questions about why it doesn't carry the device.

  • 10 Good UNIX Usage Habits

    Adopt 10 good habits that improve your UNIX® command line efficiency -- and break away from bad usage patterns in the process. This article takes you step-by-step through several good, but too often neglected, techniques for command-line operations.

Subscribe

Who Am I?

No Sweat Apparel.com