Customize Surveys with CSS
SurveyJS Form Library enables you to customize the appearance of your survey using CSS. Applied CSS classes for each theme are stored in individual JSON objects. Refer to our source code to find these objects and the style sheets they apply:
To override a CSS class, assign a substitute class to a corresponding JSON object property. In this demo, the customCss
object is used to override CSS classes for question content, answered questions, and titles of required questions. Assign this object to SurveyModel
's css
property.
You can also override styles dynamically based on a condition. Depending on the survey element whose classes you want to override, handle the following events:
The event handlers accept an object with useful properties as the second options
parameter. Redefine individual properties in the options.cssClasses
object to override required CSS classes. For example, this demo shows how to handle the onUpdateQuestionCssClasses
event to override styles for Checkboxes questions only.