Custom CSS overrides
Using CSS directly to style form layout and components
The style settings available within the theme editor are mostly simple wrappers around the CSS properties that are applied to the HTML elements rendered by Formsort. In simple terms, the options you see in the theme editor are easy-to-use controls for changing the appearance of your forms.
If you'd prefer to use CSS syntax directly to style your forms, you can do so by heading to Theme > General > Content area > Custom CSS and entering valid CSS rules there.
CSS overrides are an escape hatch! Please use our theme editor tools as much as possible.
Guide for use
Targeting specific groups and steps
You should first add ids to the steps and groups you want to customize - see our step id and group id documentation for more details.
After setting ids, you can use data-current-step-id
and data-current-group-id
attributes to target those steps and groups:
Targeting components
When writing custom CSS rules, please use the supported classnames listed in the Class Reference section below to target specific component types and their elements.
Don't use random-seeming classnames or IDs you may find within the Formsort HTML structure. These should be considered implementation details and are subject to change at any time.
Don't use highly-nested selectors. We may, from time to time, change the DOM structure of layouts and components. Highly-nested selectors are brittle and subject to breaking when this happens.
Classname reference
Step layout Overrides
.fs__stepContent
This component is the container that wraps step content, question and informational blocks. It is a good choice to override some alignment, padding and font properties that effect whole step.
For example, if you want to change color of labels in a step, you could use this snippet.
You should not override background color or image in this class name. As you can see in the image below, it can have margins around. We'll add fs__step
later so that you can override the whole page styles.
Question and Component Overrides
Comparison cards
.fs__comparison-question
Targets the comparison card div
. Can be used to set the alignment and justification of the comparison cards in their row.
.fs__comparisonCard
Targets the comparison card container. You can set overrides for components within the card such as font, alignment etc. Also you can use this class name to set gradient backgrounds and adjust positioning like margins and paddings.
The card content consists of 3 parts: title, body, and action containers:
.fs__comparisonCardTitle
to style title section..fs__comparisonCardBody
to style body section..fs__comparisonCardAction
to style action button section.
To customize highlighted
and selected
states, you can use .fs__highlighted
and .fs__selected
class names, e.g.
Dividers
.fs__divider
You can set divider color with background-color
, height, margins, etc.
Select component
Buttons
.fs__sb-container
Targets the entire Select component wrapper. The Select button container uses the display: flex
property to order the container.
Use to style all select questions that are using buttons.
Use to override the layout of a specific Select question (in conjunction with step targeting).
.fs__sb-checkmark
Use this to target select buttons that use checkmarks.
.fs__sb-image
Use this to target select buttons that use images.
Dropdowns
When a select question is turned into a dropdown, the dropdown will consist of 3 parts: container, list, and list items.
You can use .fs__dropdown-container
to apply style overrides to both input and list, such as text alignment and font style. To drill down to the dropdown list and items, you can use .fs__dropdown-list
and .fs__dropdown-list-item
.
.fs__dropdown-container
.fs__dropdown-list
.fs__dropdown-list-item
To customize highlighted
, selected
and disabled
styles of list items, you can use common Formsort class names: .fs__highlighted
, .fs__selected
and .fs__disabled
.
Text inputs
For most of input styles you can use .fs__inputInner
. Use .fs__inputWrapper
for margins and widths.
For input prefixes and suffixes, you can use .fs__inputPrefix
and .fs__inputSuffix
.
Just like in plain CSS, you can use pseudo-classes to customize input states like focus
, hover
, disabled
and invalid
.
Last updated