Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / CSS

::picker() — styling a popup picker

The ::picker() pseudo-element targets the popup portion of a form control. For select, select::picker(select) lets you style the dropdown panel separately from the closed control. Both the control and its picker must opt into basic appearance.

Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required

Syntax

::picker( <form-control-identifier>+ )
<form-control-identifier> = select

select::picker(select) { /* picker styles */ }

::picker() represents the part of a form control that pops out of the page, such as a select dropdown panel. It does not target the entire control or its opener icon; the latter is represented by ::picker-icon.

In select::picker(select), the first select selects the originating element, while the select argument identifies its picker name. The current grammar defines only the identifier select; do not assume arbitrary control names are supported. The argument-free form, ::picker, does not currently work.

The picker requires basic appearance on both the control and the pseudo-element. The CSS Forms draft describes appearance: base; CSS UI also defines appearance: base-select, which has the effect of base for select and ::picker(select). The example sets base-select on both selectors, then applies the border and background only to the picker.

This is an evolving specification feature, not a guarantee of support across browsers. The @supports condition limits the rules to browsers accepting the necessary syntax, but does not prove correct rendering. Verify the example locally, including keyboard operation; retain the default control when the required support is absent.

Examples

<!doctype html>
<html lang="en">
<meta charset="utf-8">
<title>Picker styling</title>
<style>
  @supports (appearance: base-select) and selector(select::picker(select)) {
    select,
    select::picker(select) {
      appearance: base-select;
    }

    select::picker(select) {
      border: 3px solid #163d73;
      background-color: #eef4ff;
      color: #111111;
    }
  }
</style>
<label for="fruit">Fruit</label>
<select id="fruit" name="fruit">
  <option value="apple" selected>Apple</option>
  <option value="pear">Pear</option>
</select>
</html>

Result

Initially: Apple. With the required rendering support, opening the select shows a picker with a 3px solid #163d73 border and #eef4ff background. Choosing Pear changes the displayed selection to Pear. If the @supports condition is false, the select retains its default appearance. If the condition is true but rendering support is incomplete, the select may change appearance without showing the picker as described.

The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.

Sources