Skip to main content
Every question component supported by humanize has edsl-* CSS classes so you can customise the survey appearance.

Applying custom CSS

When creating a human survey

Pass your CSS string in the humanize_schema under survey.custom_css.
Pass "survey": {"custom_css": None} (or omit custom_css) to create the survey without any custom CSS.

Updating CSS on an existing human survey

Use Coop.patch_human_survey_css to set or clear the CSS on a human survey that already exists.

Survey-level classes

Targeting one question or page

Each question and instruction on a page is wrapped in edsl-survey-item, which carries the item’s name: data-question-name for a question, data-instruction-name for an instruction. When the survey is presented by question group, edsl-survey-container carries data-group-name, the group shown on the page.
A survey with a logo shows it in edsl-survey-banner at the top of the survey, positioned left, center or right as the author chose. Surveys without a logo have no banner, so rules for these classes simply do nothing there. Set the logo itself in the humanize schema under survey.branding.logo, referencing an image you uploaded with Coop().upload_human_survey_asset(...). See Humanize schema. The logo is 40px tall by default, and its width follows the image’s proportions. To resize it, set its height and let the width follow:
To size it by width instead, set width together with height: auto. Setting both to fixed values fits the logo inside that box without stretching it. For a colored strip behind the logo, give the banner a background:
The banner spans the full width of the screen, and the logo inside it lines up with the questions. To place the logo somewhere else, such as near the edge of the screen, style edsl-survey-banner-content:

Progress indicator

The progress indicator sits above the question. Depending on how the survey is configured, it shows as a bar or as a row of step markers. A survey can also hide it, in which case nothing is rendered and there is nothing to style. Both renderings put edsl-progress on their outer element. Use that class for rules that should apply whichever one a survey uses.

Bar

Recolor the fill, don’t resize it. The fill is always as wide as the whole track, and it slides sideways to reveal only the finished portion. Setting width on it will not shorten it. Set background, border-radius, or transition instead.

Steps

Each step is one <li> holding a marker, half of the connecting line on either side of it, and an optional label below.
Style markers and labels through their step. Every <li> carries its step’s data-status, which is how you give the current marker a different look from the finished ones. Style the line through its own status. Each half carries its own data-status, which does not match the status of the step it belongs to. The half arriving at the current step is filled as soon as the step before it is done, so the current step normally holds one filled half and one empty one. Select the filled line with .edsl-progress-connector[data-status="complete"]. Reaching for .edsl-progress-step[data-status="complete"] .edsl-progress-connector instead leaves that first half gray, and the line stops short of where the respondent actually is.
To reach a single segment, combine a step’s status with a connector’s. Include the connector’s position class as well, since a step’s two halves are otherwise identical. The rule below picks out the filled half arriving at the step the respondent is on, and gives it a gradient so the line brightens as it reaches them:
Finally, markers come in two shapes: numbered circles and small dots. The survey’s configuration picks the shape, not your CSS. A rule that assumes a size, such as a fixed width, will look wrong under the other shape, so check the survey renders with the shape you expect.

Common question classes

These classes are present on every question regardless of type.

Options

Questions answered by picking from a list share these classes.

Radios and checkboxes

Each radio and checkbox is drawn by a <span>, with the <input> inside it hidden from view. Style the span, not the input.
To style the row of a selected option, use .edsl-option:has(.edsl-radio:checked).

Question-specific HTML

Budget

Checkbox

Checkbox with other

EDSL object

File upload

Free text

Linear scale

When humanize format is radio (default):

Likert five

When humanize format is radio (default):

List

Matrix

When humanize format is table (default):
Both views are always in the page, and CSS picks which one shows. To keep the table at every width:
Row labels take 25% of the table’s width by default, and the option columns share the rest. To change that, set --edsl-matrix-item-column to a percentage, on .edsl-matrix-table or on .edsl-survey-container:

Multiple choice

When humanize format is radio (default):

Multiple choice with other

Numerical

When humanize format is input (default):

Rank

Survey message

Top K

Yes/no

When humanize format is radio (default):

Comment field

If a question has comment configured in the humanize schema, an additional comment input is rendered under that question.