Make your forms beautiful with CSS
11 Fix the explanation
We’ve got a nice result for the labels, but we also need to sort out the text at the top of the form. This star is also located inside a span tag, but the span itself has a class of required in this case. The CSS is a little more complex because we can’t hide the whole span – we’re going to need that to act as the container for the background image. Instead, we’ll have to set the line-height, vertical align and use a negative text indent to hide the *. Add the rules below to the style sheet.
p span.required {
display: inline-block;
vertical-align: middle;
line-height: 3.4em;
width: 25px;
line-height: 3.4em;
text-indent: -10000px;
overflow: hidden;
background: transparent url(required.gif) no-repeat center right;
}
12 Add definition to sections

The sections of the form, as defined by the fieldsets, are useful – especially for screen readers – but look a little ‘default’. We’ve designed a nice background image to complement the rest of the design and make the most of the fieldset characteristics. Replace your existing fieldset section of CSS with the code below to load the background graphic into each fieldset.
fieldset {
margin: 10px 0 00;
padding: 0;
background:transparent url(fieldsetbg.gif)
no-repeat bottom right;
}
13 Selectively remove the background

The fieldset background makes a big difference to the feel of the whole form, but it isn’t always desirable. Have a look at the last fieldset, which only contains the submit button. It doesn’t really make sense to have either a border or a background to this fieldset, so let’s get rid of both by adding the code below at the bottom of your CSS file.
fieldset#submitform {
background-image: none;
border-style: none;
}
14 Add other elements to suit

We’ve left room in this template to accommodate error feedback to the right-hand side of the input elements. Alternatively, you could add a space beneath each field for your error-handling feedback to the user. In this case, we’re going to handle form validation server-side so there’s no need to include error handling, but read last month’s tutorial on jQuery validation to learn how to achieve the effect you see here.
fieldset#submitform {
background-image: none;
border-style: none;
}
15 Test in all browsers

We’ve deliberately chosen rules that will work across all browsers, and avoided PNG files for our design elements to accommodate Internet Explorer 6 without having to use any browser-specific hacks, but you should still conduct a full test of your forms in all browsers to make sure you’re not excluding any users from being able to use your page. By ensuring you use a semantic, accessible approach to the HTML and conducting a thorough cross-browser check, you can guarantee your forms will be user-friendly and nice to look at.


Thanks a lot..
I definitely need to work on this. Thanks!
yeah… I like it. Thanks
its wonderful share and its really helpful for new comer CSS developer
Thanks for the tutorial! There are not very many good examples of stying forms on the net.
[...] Make your forms beautiful with CSS | Web Designer – Defining the internet through beautiful design (tags: design css forms beautify) [...]
Try this Javascript refinement on the form… it works out better.
[...] Make your forms beautiful with CSS | Web Designer – Defining the internet through beautiful design Great read on Forms and CSS (tags: css forms webdesign form html style webdev design) [...]
[...] Make your forms beautiful with CSS | Web Designer – Defining the internet through beautiful design – Tutorial wie Online-Formulare mit CSS noch schöner gemacht werden können. [...]
what a great course . Thanks a lot !
[...] Make your forms beautiful with CSS | Web Designer – Defining the internet through beautiful designwebdesignermag.co.uk [...]
谢谢 ,写的很好
[...] Make your forms beautiful with CSS [...]
[...] Make your forms beautiful with CSS [...]
[...] Make your forms beautiful with CSS [...]
[...] beautiful forms with cascading style sheets [download tutorial [...]
[...] beautiful forms with cascading style sheets [download tutorial [...]
Thank you for your input.
This was a great tutorial, I did pick up 1 or 2 new techniques that I’ll use in my next form. I do however have a question, how would you go about creating a Li with 2 text boxes within it i.e. Lets say you want to have title and first name next to each other or if the space for the fieldset requires a 2 or 3 column layout?
A tutorial showing that would be great
Good tutorial. The form provided me with new ideas for my next form.
Thanks again
Nice
Cool, Thanks for input
[...] Make your forms beautiful with CSS | Formulare sind meist ein wichtiger Bestandteil einer Website. Und damit auch das Aussehen der Formulare stimmt, gibt es CSS! [...]
[...] Make your forms beautiful with CSS [...]
Thanks. Nice tutorial.
[...] 16. Make your forms beautiful with CSS [...]
[...] 16. Make your forms beautiful with CSS [...]
One of the best form examples I’ve seen in a while. Good job!
[...] 15. Make your forms beautiful with CSS [...]
[...] 15. Make your forms beautiful with CSS [...]
me too. like this one
Thanks lot!
[...] 16. Make your forms beautiful with CSS [...]
very nice..
Good guide, picked up a few ideas. Many thanks! Ted
Nice helpful stuff. Thanks
[...] 3. Make your forms beautiful with CSS [...]
Good guide, picked up a few ideas. Many thanks! Ted
It is so important to keep on top of the latest techniques, articles like this are great for improving skills and always giving the end user a good experience when visiting your website. Thank you
[...] 16. Make your forms beautiful with CSS [...]
What's your opinion?