WEB-DESIGN-Co.Com - stylish and accessible form using CSS
Web Design Co
 
WEB DESIGN Co
 
 
 
 
 
 
 
 
 
 
betUs casino

stylish and accessible form using CSS
By: SAM HICKSON

Stylish and accessible forms in CSS

The majority of sites designed these days have at least one form. If you’re a web designer then you’ll know that creating a template is essential if you are to be efficient in your work. Many times I’ve compromised on a form’s design due to time restrictions. Below is a template that I use and that is quite flexible in its design. This form allows for any type of input field from a simple textfield to a group of radio buttons. If your quite comfortable with CSS then please feel free to adapt this code. The fun you can have with this form can really change the way your forms look and make a great deal of difference to your overall web site design.

XHTML CODE

Below is a basic form structure. I’ve used ordered lists

    to segment the form and
  1. tags for each row of the form just as I find this easily breaks up the code for use by novice CSS users.

    1. Gender *
    2. Additional information

    Additional Tags

    If you look through the code you will see some tags which you may deem as unnecessary (i.e
    tags after the radio button). These are to enable a cross browser compatible layout. Within the CSS code you will notice at the beginning that all the margins and padding are set to zero. Alternatively you could place the form in a div with zero margins and padding but it is entirely up to you.

    CSS Code

    * { margin: 0; padding: 0; } form.cssform { width: 430px; font-size: 0.8em; line-height: 20px; font-family: Tahoma, Verdana; } fieldset { margin-bottom: 10px; border: none; } label { line-height: 1.8; vertical-align: top; float: left; text-align: right; margin-right: 1em; width: 120px; font-weight: bold; } fieldset ol, li { margin: 0px; padding: 5px; list-style: none; } fieldset fieldset { border: none; margin: 3px 0 0; } fieldset fieldset legend { padding: 0 0 5px; color: #000000; } legend { padding: 0 10px 0 10px; font-weight: bold; } fieldset fieldset label { font-weight: normal; width: 170px; margin-left: 123px; text-align: left; } form em { font-style: normal; font-weight: bold; color: #FF0000; } input.newfield { background: url(../images/newfield.gif) repeat-x 0 100%; border: none; font-weight: bold; } textarea { float: left; background: none; border: 1px solid #999999; width: 100%; font-weight: bold; font-size: 1em; } .submitbutton { width: 10em; height: 1.6em; font-weight: bold; color: #FFFFFF; background-color: #99ccff; background-position: center; }

    Browser Compatibility

    Currently this form has been tested and works in IE5.5, IE6.0 and IE7 and Firefox.

    See the working example here Code and example

    Sam Hickson founded Hatch Media in 2006 and has written many successful articles including this one. I hope you enjoyed it and that it is of use to you either now or later in the future.



    Part 2 of your free guide to building a website


    Part 2 of your free guide to building a website Summary The last tutorial showed how to create your own website in WebEden and how to edit the text on the page. We'll now look at more advanced editing of objects within a page and making sitewide changes by editing the master page. This is one of the best ways of making your site professional when you're building a website with Webeden. Introduction The master page is one of the advantages of the Web Eden system, as it uses . . .



     


    Return to Web-Design-Co's Web Design Index


     

Vegas Palms Casino
free-traffic.info - Get-Paid-More.Net - Traffic Exchange - Travel-A-Z - Dating-A-Z - Get Free Traffic

USA Online Casinos - Sun Palace Casino - River Belle Casino - Players Palace Casino - Platinum Play Casino - Zodiac Casino

Virtual City Poker - Virtual City Casino - Vegas Villa Casino - Wager Web Casino - Yukon Gold Casino

 
River Belle Online Casino
 
webmasterquest.com free website traffic

Copyright Web-Design-co.com 2002- 2007