Polls, surveys & forms

Style your poll with custom CSS

The class names of the poll page and its questions, and CSS examples that change how they look.

Last updated

When colors, a font and a logo aren’t enough, a theme can carry its own CSS. It applies to the poll page and the results page of every poll that uses the theme, and to the previews in the editor. Custom CSS comes with the Business plan, see Plans and credits.

Where to add it

  • For one poll: open the poll’s Design tab and write your CSS under Custom CSS. Save the design as a theme to keep it.
  • In a theme: under Themes, open a theme and fill in Custom CSS. It shows on every poll that uses the theme.
  • For your brand: on the Brand page, the CSS goes into your brand’s look.

The CSS can be up to 20,000 characters long. It can’t load other stylesheets, so @import lines are left out, and it can’t contain the < character.

Write selectors that win

The page styles its parts with the same class names you use, so a rule with a single class often loses to the page’s own. Put .vote-theme in front of your selectors: it holds the whole poll, on the poll page, the results page and in the previews, and your CSS wins any tie with the page’s styles.

css
/* Too weak: the page keeps its own rounded corners. */
.choice {
	border-radius: 0;
}

/* Works: */
.vote-theme .choice {
	border-radius: 0;
}

If a rule still doesn’t apply, for example on :hover, add one more class, like .vote-theme .vote-step .choice:hover.

The page

ClassWhat it is
.vote-themeEverything the theme styles. On the poll page also .vote-root.
.vote-root.embedThe poll when it is embedded on another website.
.vote-mainThe area that holds the poll, below the progress bar.
.vote-cardThe poll itself, as wide as its content allows.
.vote-card-designThe card, when the theme shows the poll in a card.
.vote-logoThe theme’s logo above the poll.
.vote-headerThe poll’s title and description.
.form-titleThe poll’s title, an h1.
.form-descriptionThe text under the poll’s title.
.deadlineThe line saying when the poll closes.
.progressThe progress bar at the top, with .progress-fill for its filled part.
.vote-formThe form with all questions and buttons.
.vote-pageThe questions of the page being shown.
.page-headingThe title of a page in a poll with several pages.
.vote-actionsThe row with the submit, next and back buttons.
.btn-primaryThe main button, like Submit or Next.
.btn-ghostThe plainer buttons, like Back or View results.
.noticeNotes to the voter, like a restored response.
.form-errorAn error message for the whole form.
.statusThe end screen after voting, with .responded-title as its title.
.vote-footerThe line at the bottom of the page.

Questions

Each question is a section with the class .vote-step. It gets a data-invalid attribute while it shows an error.

ClassWhat it is
.vote-stepOne question with its title, description and answers.
.step-headThe row with the question’s title.
.step-titleThe question’s title, an h2 (an h1 when the poll has no title).
.requiredThe * after the title of a required question.
.optionalThe Optional label next to a question’s title.
.step-descriptionThe text under the question’s title.
.step-errorThe error message under a question.

Answers

ClassWhat it is
.choiceOne option of a multiple choice or image question.
.choice.checkedAn option the voter picked.
.choice.disabledAn option that can’t be picked, like a full one.
.choice .markThe round or square box in front of an option.
.choice .labelThe option’s text, with .description under it.
.choice .mediaThe image of an option in an image question.
.choice .percentAn option’s share of the votes, when results show while voting.
.dropdown-selectThe box around a dropdown question’s list.
.text-answerThe field of a text, number, email or date question.
.stars, .starA star rating and each of its stars.
.numbers, .numberA number scale and each of its numbers, .checked when picked.
.yes-no, .tileA yes or no question and its two tiles, .tile-yes and .tile-no.
.rankingA ranking question’s list of options.
.matrixA matrix question’s table, with .matrix-row and .matrix-cell.

The results page

ClassWhat it is
.resultsThe results of all questions.
.barsThe bars of one question.
.bar-nameAn option’s name.
.bar-trackThe bar’s background, with .bar-fill inside.
.bar-valueAn option’s votes and share.

Change the colors everywhere

The page takes its colors from a few CSS variables. Setting them changes everything that uses them at once, like borders, hover states and selected options:

css
.vote-theme,
.vote-theme .vote-card-design {
	--vote-accent: #0f766e; /* selected options, focus rings, links */
	--vote-button: #0f766e; /* the main button */
	--vote-button-text: #ffffff;
	--vote-border: #d6d3d1; /* borders of options and fields */
	--vote-surface: #fafaf9; /* the background of options and fields */
}

--vote-bg and --vote-text are the page’s background and text color, --vote-muted the color of lighter text. For most colors, it’s simpler to set them in the theme itself.

Examples

Square options with a thicker border when picked:

css
.vote-theme .choice {
	border-radius: 0;
}

.vote-theme .choice.checked {
	border-width: 3px;
}

A larger poll title in capitals:

css
.vote-theme .form-title {
	font-size: 2.5rem;
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

A line between questions:

css
.vote-theme .vote-step + .vote-step {
	padding-top: 1.5rem;
	border-top: 1px solid var(--vote-border);
}

A pill-shaped button across the whole width:

css
.vote-theme .vote-actions .btn-primary {
	width: 100%;
	border-radius: 999px;
}

A wider poll:

css
.vote-theme .vote-card {
	max-width: 52rem;
}

No logo when the poll is embedded on your website:

css
.vote-root.embed .vote-logo {
	display: none;
}

Hide the description under the poll’s title:

css
.vote-theme .form-description {
	display: none;
}

Style only the second question:

css
.vote-theme .vote-step:nth-of-type(2) .step-title {
	color: var(--vote-accent);
}

Good to know

  • The previews: the questions and their answers look the same in the Design tab as on the poll page. The parts around them, like the poll’s title, are built differently there, so check those on the poll page itself.
  • Dark mode: with a theme in Auto mode, the page follows each visitor’s light or dark mode. To style only the dark one, start a selector with .dark, like .dark .vote-theme .choice.
  • Class names only: other class names on the page, like svelte-… and short ones such as flex or text-sm, can change at any time. Use the ones listed here.
  • Shared themes: a theme shared with a workspace keeps its CSS. It shows when the poll’s plan includes custom CSS.

Related articles