.edsl-question-text, for example, selects question wording. The HTML reference shows the structure EDSL generates; you do not need to write that HTML yourself.
Applying custom CSS
When creating a human survey
The following example gives the survey a light-gray background and makes question text bold and dark gray. Pass the CSS string undersurvey.custom_css; the other schema entries make the rating a dropdown and feedback optional.
survey.preview(humanize_schema=humanize_schema) to inspect the appearance before publishing, including how long questions and answer options fit on a phone. Pass "survey": {"custom_css": None} (or omit custom_css) to create the survey without custom styling.
Updating CSS on an existing human survey
UseCoop.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 inedsl-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.
Survey banner and logo
A survey with a logo shows it inedsl-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:
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:
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 putedsl-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.
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.
.edsl-option:has(.edsl-radio:checked).
Question-specific HTML
Budget
Checkbox
Checkbox with other
EDSL object
File upload
Free text
Linear scale
- Radio
- Dropdown
When humanize format is
radio (default):Likert five
- Radio
- Dropdown
When humanize format is
radio (default):List
Matrix
- Table
- Carousel
When humanize format is 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
table (default):--edsl-matrix-item-column to a percentage, on
.edsl-matrix-table or on .edsl-survey-container:Multiple choice
- Radio
- Dropdown
When humanize format is
radio (default):Multiple choice with other
Numerical
- Input
- Slider
When humanize format is
input (default):Rank
Survey message
Top K
Yes/no
- Radio
- Dropdown
When humanize format is
radio (default):Comment field
If a question hascomment configured in the humanize schema, an additional comment input is rendered under that question.
