Pseudo-classes and state styling

A pseudo-class targets an element in a specific state — when the user hovers over it, when it has keyboard focus, or when it is the first child of its parent. Site Designer lets you style these states without writing any CSS manually.

What pseudo-classes are

Pseudo-classes are keywords you append to a selector with a colon. They do not target a specific element; they target an element when a condition is true.

Common pseudo-classes you will use regularly:

Pseudo-classWhen it activates
:hoverMouse pointer is over the element
:focusElement has keyboard or programmatic focus
:activeElement is being clicked/pressed
:visitedLink has been visited (applies to <a> only)
:focus-visibleElement has focus via keyboard (not mouse)
:first-childElement is the first child of its parent
:last-childElement is the last child of its parent
:nth-child(n)Element is the nth child (supports formulas like 2n+1)
:placeholderPlaceholder text inside an <input> or <textarea>

The state dropdown in the Design pane

Site Designer exposes pseudo-class editing through the state dropdown at the top of the Design pane. By default it shows Default (no pseudo-class). Click the dropdown to switch to a state context.

While a state is selected, every style change you make is written specifically to that pseudo-class. The selector field updates to show the full selector — for example, .nav-link:hover — so you always know exactly what you are editing.

Styling a hover state

  1. Select the element

    Click the element on the canvas.

  2. Confirm the active class

    Check the class field in the Design pane. Make sure the class you want to style is active (highlighted).

  3. Switch to :hover

    Click the state dropdown and choose :hover.

  4. Make your style changes

    Change background color, text color, transform, or any other property. These changes only apply when the element is hovered.

  5. Return to Default

    Click the state dropdown and choose Default to exit the hover context and return to normal editing.

  6. Add a transition

    In the Effects pane, add a transition on the same class (in Default state) so the change animates smoothly rather than snapping.

:focus-visible for accessible focus styles

Use :focus-visible rather than :focus when styling keyboard focus rings. :focus-visible only activates for keyboard navigation, not mouse clicks — so you get a clear visible indicator for keyboard users without the outline appearing on every mouse interaction.

All interactive elements — buttons, links, form inputs — should have a visible :focus-visible style. The WCAG 2.2 AA standard requires a minimum 3:1 contrast ratio between the focus indicator and the surrounding background.

:placeholder for input text

The :placeholder pseudo-class (technically ::placeholder in modern CSS — Site Designer accepts both) targets the placeholder text in <input> and <textarea> elements. Use it to change the color, font style, or opacity of placeholder text.

Note that placeholder text must have a contrast ratio of at least 4.5:1 against the input background to meet WCAG AA, even though browsers often default to a low-contrast gray.