Style a native select progressively
Keep the label, name and ordinary text options. The same markup works as a standard select in browsers without the customisable picker.
<div class="delivery-field">
<label for="delivery-speed">Delivery speed</label>
<select id="delivery-speed" name="delivery-speed">
<option value="standard">Standard — 3 to 5 working days</option>
<option value="express">Express — next working day</option>
</select>
</div>
@layer components {
.delivery-field > select {
font: inherit;
max-inline-size: 100%;
}
@supports (appearance: base-select) and selector(::picker(select)) {
.delivery-field > select,
.delivery-field > select::picker(select) {
appearance: base-select;
color: var(--color-text);
background: var(--color-surface);
border: 1px solid currentColor;
}
.delivery-field > select:focus-visible {
outline: 2px solid currentColor;
outline-offset: 2px;
}
@supports selector(::field-content) {
.delivery-field > select::field-content {
font-weight: 600;
}
}
}
}
Define the colour tokens in the theme layer and check contrast in every theme. appearance: base-select must apply to both the select and its picker. Richer markup using<selectedcontent> is optional; avoid interactive elements inside options and verify parsing and hydration before introducing it in a framework.
The ::field-content rule styles the selected text in the closed control using plain options. A separate feature query lets browsers apply the picker styles when they support onlybase-select and ::picker(select).
Support checked 15 November 2026. The customisable picker works in Chromium and Safari 27. Safari 27.2 added::field-content. See the customisable select compatibility notesand the Safari 27.2 release notes.
Test keyboard selection, Escape, screen reader announcements, forced colours, zoom, and form submission with the enhancement enabled and disabled. Record both feature queries in your browser support policy. See the LSCSS browser support guidance.
Let a textarea grow with its content
Use rows to give the native textarea a useful starting height. Where field-sizing: content is supported, the CSS sets the starting height, lets the field grow as the user types, and caps its height so longer answers scroll inside it.
<label for="delivery-notes">Delivery notes (optional)</label>
<textarea
class="delivery-notes"
id="delivery-notes"
name="delivery-notes"
rows="4"
></textarea>
@layer components {
.delivery-notes {
display: block;
box-sizing: border-box;
inline-size: 100%;
font: inherit;
}
@supports (field-sizing: content) {
.delivery-notes {
field-sizing: content;
min-block-size: 5lh;
max-block-size: 12lh;
overflow: auto;
}
}
}
Check that the last line stays reachable at the height limit and that the field still fits its container when zoomed.
Support checked 15 November 2026. field-sizing became Baseline Newly available in June 2026. See the compatibility notes.