RMSforms – A flexible CSS Forms Framework to Help Style Those Pesky Forms
If you are a Web designer or developer, you know that styling forms with CSS is a huge pain. Not only are browser inconsistencies rampant in form elements, but it is very difficult to get an advanced form to layout correctly, both visually & semantically. To alleviate these issues and to help designers / developers avoid unwanted stress, I took a crack at developing “RMSforms”, a CSS forms framework. To apply it to your forms, simply download the RMSforms CSS Stylesheet, link to it from your HTML and apply the correct classes to the HTML structure described below and you will be on your way to creating complex CSS-based, tableless, flexible forms with ease.
Download RMSforms-v0.5.css
View Examples / Reference Sheet
RMSforms v0.5 was tested in IE6 – 7, Firefox 3 & Google Chrome. More testing is to come.
It is validated using XHTML STRICT doctype
The HTML
“RMSforms”, CSS forms framework is based off a very simple HTML structure:
<fieldset>
<legend></legend>
<ul class="form [modifier]">
<li><label class="[label modifier]"></label><input/></li>
</ul>
</fieldset>
The Beauty of the Un-ordered List
Un-ordered lists are a great tool for grouping form elements together because they make sense semantically and provide for the level of flexibility needed to style a form effectively.
In essence, a web-based form is a LIST of form fields with coresponding labels that are grouped together visualy based on their association to each other. In the HTML structure of RMSforms, the <ul> provides a container for the list of all related labels / form fields and the <li> provides a container for the grouping of the individual <label> / form field combinations. In more complex forms, a <label> can often times be used to distinguish not only just one <input>, but a "nested form" that has a series of labels / form fields. With the the <ul><li> structure, nesting a form is very easy.
Other CSS form techniques use <p> tags, <div> tags, and line breaks to group individual labels & form field combinations together. I think these grouping methods leave a lot to be desired as far as flexibility and semantics. In my opinion, line breaks should be avoided whenever possible, <p> tags should only be used when presenting a paragraph, and although <div> tags would work, your html code would get real sloppy in an advanced form.
The CSS
In every web-based form there are two layout orientations that can be used to display the relationship between a <label> and it’s corresponding form field; horizontal or vertical. The same is true for the visual orientation of the <label> / form field groupings to one another. This simple concept is the basis for the class names being used within the “RMSforms” framework.
The allmighty “form” class
Each top-level form <ul> in the "RMSforms" html structure has a base class of “form” applied to it. This class establishes a basic visual relationship between the elements within the form, sets a background-color and provides some outer padding.
<ul class=”form”></ul>
The Modifier Classes
The most important classes defined in the "RMSforms" stylesheet are the “form modifiers”. These are 3 letter classes that modify the visual relationship between the <li>, <label>, and <input> elements respectively.
The first letter in the modifier class names describes the orientation of the <LI> tags in the form <ul>, the second letter describes the orientation of the <LABEL> tags in he form <ul> and the third letter describes the orientation of the form fields within the form <ul>. The 3 letters that make up the modifier class names are “H”, “V” and “I”
- H = Horizonal Block
- V = Vertical Block
- I = Inline
A list of all the form modifier classes:
- vvv – Vertical <li>, Vertical <label>, Vertical form fields
- hvv – Horizontal <li>, Vertical <label>, Vertical form fields
- hii – Horizontal <li>, Inline <label>, Inline form fields
- hhh – Horizontal <li>, Horizontal <label>, Horizontal form fields
- vii – Vertical <li>, Inline <label>, Inline form fields
- vhh – Vertical <li>, Horizontal <label>, Horizontal form fields
Usage Example…
The class “hvv” describes a form with <li> tags that are layed out horizontally and <label> tags which are vertical block elements that sit on top of vertical block form field tags.
<ul class=”form (default form class) hvv (form modifier)“></ul>
To view this example in html, take a look at the RMSforms example page
Label Modifiers
Often times, you may want the visual orientation between a <label> and form field tags to vary within a form. For example, if one of your labels in a “VHH” form has a lot of text in it, you may want it to sit on top of it’s corresponding form field rather than to the left of it. This is where the label modifiers come into play. Label modifiers are used to override the classes placed on the form <ul> and should be applied to <label> elements within a form. The exiting label modifiers are classes:“v” or “h”.
Form Nesting
One of the advantages to this form framework is the ability to nest form <ul> tags without a problem. In many advanced forms, problems pop up when needing to incorporate multiple <label> / form field combinations within one grouping. Using the form modifier classes, simply nest a form <ul> with the appropriate modifier applied to it within an <li> and you’re all set.
Why Not Just Use Tables?
Ah, the great question. Why not just use tables? Wouldn’t be a lot easier? Yes it would, but, being a semantic Web design nut, I believe tables should only be used in html to describe tabular data. If your not too concerned with html semantics, it is a very plausible solution for the laying out forms.
Comments, Suggestions and Modifications Are More Than Welcome.
"RMSforms" CSS Forms framework is a work in progress. The goal of this project is to make form styling as simple as possible. There are probably many scenarios in that I didn’t account for, or bugs that I have not come across. If you have any questions, comments or ways to improve this framework please post them up or contact me directly. I look forward to hearing from you!


















February 16th, 2009 at 3:14 pm
Before I go to the (monolithic) effort of starting a project using this, how is it affected by prior inclusion of a reset stylesheet (say, Yahoo’s, or Meyer’s) ? Does it hold up, or does it require heavy modification?
February 17th, 2009 at 7:21 pm
Keryn, Good question! After testing it out with Eric Meyer’s latest reset stylesheet, Beyond the default styles applied to the fieldset and legend elements, everything seems to stay in tact very well.
May 31st, 2009 at 8:47 pm
super!!!
October 28th, 2009 at 11:10 am
Great Work!
Looks good in Opera 9.64 too!
December 1st, 2009 at 1:25 pm
How about styling error messages on individual fields?
December 10th, 2009 at 1:03 pm
Great work! I love your form framework!
December 18th, 2009 at 9:38 pm
Hi Randy, thanks a ton for this uber cool CSS Framework. It’s so easy to plug it to my existing app without breaking anything, including the existing CSS frameworks. Look forward to the next version.
December 21st, 2009 at 7:39 am
I like it very much, if you want to get it adopted more easily by people, consider to make it work well with JQuery and promote it as a “JQuery form plugin”.
Lots of people who use JQuery look for form plugin.
December 22nd, 2009 at 1:54 am
[...] Shared RMSforms – A flexible CSS Forms Framework to Help Style Those Pesky Forms. [...]
December 22nd, 2009 at 12:46 pm
excellent work!!
December 23rd, 2009 at 2:12 am
Great idea, will definitely be giving this a spin, thanks!
December 23rd, 2009 at 4:27 pm
I really appreciate sharing your approach with us. Thanks for that!
BUT: Apart from a list (imo) not being the semanticaly correct markup to wrap a form in (i personally prefer using a combination of fieldsets to group elements and divs/spans for layout), your approach lacks semantical and meaningfull naming of CLASSES (as almost all CSS Frameworks do).
You COULD add meaningfull classnames additionaly but that would make your forms much more bloated.
As for me I’ll keep thinking about every form and it’s structure (as i do for every element in the markup) and leave the frameworks alone until someone thinks of a better way to automize CSS layouts or HTML5 and CSS3 finally are supported well across all Browsers (which would make extra elements useless).
I recommend reading about microformats and semantic class naming here:
http://www.w3.org/QA/Tips/goodclassnames
http://woork.blogspot.com/2008/11/css-coding-semantic-approach-in-naming.html
December 26th, 2009 at 7:26 pm
Nice work — it would be nice to see this up on a code repository like GitHub or Google code.
December 26th, 2009 at 9:35 pm
Interesting, I’ll definitely take a look at this!
December 27th, 2009 at 4:49 am
You should be using the “for” attribute in the labels (along with an “id” attribute in the inputs)
December 27th, 2009 at 8:05 pm
[...] RMSforms – A flexible CSS Forms Framework to Help Style Those Pesky Forms (tags: forms webdesign css) [...]
December 28th, 2009 at 6:03 am
[...] RMSforms is a CSS framework for making this process easier. [...]
December 28th, 2009 at 4:02 pm
[...] crear a tu manera forms complejos basados en CSS, flexibles y cross-browser. Si lo deseamos podemos ver más información en la página del autor (en inglés). Descargar [...]
December 28th, 2009 at 7:28 pm
[...] I found a great CSS Framework for form, called RMSforms. In the post page, the author explain a lot of things behind the form design and provide the [...]
December 28th, 2009 at 10:53 pm
Hmmm, very interesting . . .
December 29th, 2009 at 12:10 am
[...] URL: http://www.rmsjr.com/blog/web-design/rmsforms-a-flexible-tableless-css-forms-framework/ [...]
December 29th, 2009 at 6:40 am
Good post. Thanks!
December 30th, 2009 at 7:09 pm
[...] RMSforms development “is part of the CSS to overcome this problem and helps designers and developers to avoid trouble. This demo shows the output from a few more combinations to see what can be achieved with RMSforms CSS framework. [...]
January 20th, 2010 at 4:02 pm
Saved me a load of browser issues. thanks!
February 19th, 2010 at 1:51 am
[...] RMSForms [...]
May 10th, 2010 at 12:50 pm
Outstanding article.