Styling Forms with CSS (2024)

  • Knowledge Base
  • Tutorials

Most styling of a form can be achieved using our responsive layout editor and customize tools, but sometimes you will want to apply more granular styling using some custom CSS (Cascading Style Sheet). This article describes how to use CSS to style forms created with WS Form.

If you need help understanding he HTML attributes used by WS Form, please see our HTML Form Attributes article.

If you require additional assistance understanding CSS, please see our Custom Project Development article.

Contents

  • Basic Examples
  • Targeting Forms
  • Adding Classes to a Form
  • Setting the Form ID in a Shortcode
  • Learning CSS

Basic Examples

The following examples are for use with the WS Form framework. If you are using Bootstrap or Foundation please refer to the documentation for those frameworks.

Labels

CSS selector: wsf-label

Example of making all labels white:

.wsf-form .wsf-field-wrapper .wsf-label { color: #FFFFFF;}

Fields

CSS selector: wsf-field

Example of giving fields a white background and black text:

.wsf-form .wsf-field-wrapper .wsf-field { background: #FFFFFF; color: #000000;}

Buttons

CSS selector: wsf-button

Example of making buttons red with white text:

.wsf-form .wsf-field-wrapper .wsf-button { background: #FF0000; color: #FFFFFF;}

Placeholders

CSS selector: wsf-field::placeholder

Example of making placeholder text gray:

.wsf-form .wsf-field-wrapper .wsf-field::placeholder { color: #999999;}

Help Text

CSS selector: wsf-help

Example of making help text white:

.wsf-form .wsf-field-wrapper .wsf-help { color: #FFFFFF;}

Targeting Forms

WS Form supports multiple forms per page. Each form on the page is called an instance.

Each instance on the page is given a unique ID. For example:

<formid="ws-form-1" data-id="123" class="wsf-form">

Let’s break those attributes down.

The id attribute is a unique identifier for the form. It has the format ws-form-<instance_id>. In this example it is referencing instance 1.

The data-id attribute indicates which form ID is being rendered. In this example it is rendering form ID 123.

The class attribute wsf-form appears on all forms. You can use it to target all forms rendered by WS Form.

Selector Examples

.wsf-form Target all forms.

form[data-id="123"] Target form ID 123 on any page.

#ws-form-1 Target the first instance of a form on any page.

Adding Classes to a Form

It is also possible to add classes to form elements so that you can target them with your own CSS.

Form

To add a class to the form.

  • Click the settings icon at the top of the layout editor.
  • Click the Styling tab in the sidebar.
  • In the Classessettings enter a class name in the Form Wrappersetting.

Tabs (All)

Tabs are made up two components, the tab itself and the tab content. To add a class to these components:

  • Click the settings icon at the top of the layout editor.
  • Click the Stylingtab in the sidebar.
  • In the Classessettings enter a class name in the Tab Wrapper or Tab Content Wrappersetting.

The class(es) entered will be added to all tabs in the form.

Tabs (Individual)

If you have more than one tab in your form, you can also add a class each tab content individually. To do this:

  • Click the settings icon for a specific tab in the layout editor.
  • Click the Advancedtab in the sidebar.
  • In the Classes settings enter a class name in the Tab Content Wrappersetting.

The class(es) entered will be added to the content for that tab.

Sections (All)

To add a class to all sections in your form:

  • Click the settings icon at the top of the layout editor.
  • Click the Stylingtab in the sidebar.
  • In the Classes settings enter a class name in the Section Wrappersetting.

The class(es) entered will be added to all sections in the form.

Section (Individual)

To add a class to a specific section in your form:

  • Click the settings icon for a specific section in the layout editor.
  • Click the Advancedtab in the sidebar.
  • In the Classes settings enter a class name in the Section Wrappersetting.

The class(es) entered will be added to that specific section.

Fields (All)

Fields are made up of a wrapper and the field itself. To add wrapper or field classes to all fields on your form:

  • Click the settings icon at the top of the layout editor.
  • Click the Stylingtab in the sidebar.
  • In the Classes settings enter a class name in the Field Wrapper or Fieldsetting.

The class(es) entered will be added to all fields in the form.

Field (Individual)

To add a class to a specific field in your form:

  • Click the settings icon for a specific section in the layout editor.
  • Click the Advancedtab in the sidebar.
  • In the Classes settings enter a class name in the Field Wrapper or Fieldsetting.

The class(es) entered will be added to that specific section.

Setting the Form ID in a Shortcode

The format of the WS Form shortcode is very simple:

Unable to read published form data

… where 123is equal to your form ID.

The shortcode also has an option element_id parameter which enables you to set the ID of the form element. For example:

Unable to read published form data

This is useful if you want to target your form using JavaScript.

Learning CSS

Here are some great online resources for learning CSS:

Styling Forms with CSS (2024)
Top Articles
Berkeley Rsf Crowd Meter
Télécharger K9 Web Protection 4.2.89 pour Windows
Mickey Moniak Walk Up Song
Bild Poster Ikea
What happened to Lori Petty? What is she doing today? Wiki
Jesus Calling December 1 2022
Triumph Speed Twin 2025 e Speed Twin RS, nelle concessionarie da gennaio 2025 - News - Moto.it
How to change your Android phone's default Google account
When is streaming illegal? What you need to know about pirated content
Hay day: Top 6 tips, tricks, and cheats to save cash and grow your farm fast!
Best Cav Commanders Rok
Items/Tm/Hm cheats for Pokemon FireRed on GBA
Aces Fmc Charting
No Hard Feelings Showtimes Near Cinemark At Harlingen
Char-Em Isd
Navy Female Prt Standards 30 34
Costco Gas Foster City
Average Salary in Philippines in 2024 - Timeular
Sni 35 Wiring Diagram
Satisfactory: How to Make Efficient Factories (Tips, Tricks, & Strategies)
Mychart Anmed Health Login
Quest: Broken Home | Sal's Realm of RuneScape
Tu Pulga Online Utah
Obituaries Milwaukee Journal Sentinel
Naya Padkar Gujarati News Paper
Everything To Know About N Scale Model Trains - My Hobby Models
Cognitive Science Cornell
Villano Antillano Desnuda
Section 408 Allegiant Stadium
Evil Dead Rise Showtimes Near Regal Sawgrass & Imax
Sam's Club Near Wisconsin Dells
Napa Autocare Locator
Grand Teton Pellet Stove Control Board
Mumu Player Pokemon Go
Bernie Platt, former Cherry Hill mayor and funeral home magnate, has died at 90
Rocksteady Steakhouse Menu
Green Bay Crime Reports Police Fire And Rescue
Movies123.Pick
Studio 22 Nashville Review
Oriellys Tooele
All Characters in Omega Strikers
Arigreyfr
Fedex Passport Locations Near Me
Scythe Banned Combos
Streameast Io Soccer
Kjccc Sports
25100 N 104Th Way
Image Mate Orange County
O'reilly's On Marbach
Basic requirements | UC Admissions
Who We Are at Curt Landry Ministries
Latest Posts
Article information

Author: Jerrold Considine

Last Updated:

Views: 6188

Rating: 4.8 / 5 (78 voted)

Reviews: 85% of readers found this page helpful

Author information

Name: Jerrold Considine

Birthday: 1993-11-03

Address: Suite 447 3463 Marybelle Circles, New Marlin, AL 20765

Phone: +5816749283868

Job: Sales Executive

Hobby: Air sports, Sand art, Electronics, LARPing, Baseball, Book restoration, Puzzles

Introduction: My name is Jerrold Considine, I am a combative, cheerful, encouraging, happy, enthusiastic, funny, kind person who loves writing and wants to share my knowledge and understanding with you.