HomeUsing FormSpringBuilding FormsCustom Form Stylesheets and CSS

2.17. Custom Form Stylesheets and CSS

Although FormSpring's Style Templates are a powerful way to customize your forms, sometimes you want to do something with your form that's a little off the map. That's where the Custom CSS rules come in.

You can easily add custom CSS styles to your form, no matter whether it's a FormSpring hosted form or embedded on your own site.

If your form is using a custom Style Template, the easiest way to add styles is back in the Template Builder. Simply choose the HTML and CSS tab, as shown below.

If you're not using a custom template and the form is being hosted on your own site, you'll simply add to the CSS Stylesheet file that your site already uses.

 

Adding custom CSS rules

 

The following is a guide of the available CSS classes and IDs you can use in your stylesheet rules to style your form the way you want it. At the bottom of the list are some concrete examples to get you started.

 

CSS Classes & IDs

.fsForm
the class of the <form>. Each form also has an unique ID

.fsTable
the table used to hold the form elements

.fsSectionHeading
the <h1> element that holds the heading for a section

.fsSectionText
the descriptive text in a section header

.fsSupporting
the text used to help describe the field

.fsCallout
supporting text used as a callout box

.fsRow
a row in the table

.fsFieldRow
a row that contains form fields

.fsCell
the individual <td> in the form table

.fsRowBody
the <td>s that actually hold form content. Used to set the background color of the form

.fsSectonCell
the cell that holds the section header content

.fsSection
a class to denote a section field

.fsLabel
the label for a form field

.fsRequiredLabel
the label for a required form field

#fsFooterImage
the image at the bottom of the form

#fsHeaderImage
the image at the top of the form

.fsFieldFocused
a class applied to the containing <td> when a form field is focused on

.fsReadOnly
a field that is read-only

.fsValidationError
a class applied to the containing <td> when a form field has invalid input


How-to...

...change the label color
.fsLabel { color: #aabbcc; }

...change the text color on the text fields
.fsRowBody input[type=text] { color: #aabbcc; }

...change the text color on the text areas
.fsRowBody textarea { color: #aabbcc; }

...change the text color of the supporting text
.fsSupporting { color: #aabbcc; }

...change the background color of the form
.fsRowBody { background-color: #aabbcc; }

...change the spacing between form rows
.fsFieldRow td { padding-bottom:18px; }

...remove the section header highlight
.fsSectionRow td.fsRowBody { background-image:none; }

...reduce the space between sections
.fsForm .fsTable { margin: 0 auto; padding: 0 }

...remove section borders
.fsRowTop, .fsRowBottom, .fsRowOpen, .fsRowClose { display: none; }

This page was: Helpful | Not Helpful