Styling Forms: appearance, accent-color, field-sizing and Customizable select
Styling form controls without breaking them: a form reset with font: inherit, appearance: none for custom checkboxes, accent-color and color-scheme, field-sizing for auto-growing fields, customizable select with base-select, and accessible states.
kvi5hnuCode Sprout team member7 min readOn this page
Form controls are partly drawn by the operating system, so they've long been the hardest elements to style. Modern CSS has closed most of the gap: you can theme native controls with one property, rebuild checkboxes, make fields grow with their content, and now fully style <select>, all while keeping the built-in keyboard, screen reader and mobile behavior.
A form reset
Controls don't inherit typography. Tested in Chrome: on a page with an 18px Georgia body, an <input> and a <button> were 13.33px Arial. Their default box-sizing also differs: content-box for text inputs, border-box for buttons. A small reset fixes both:
input, button, select, textarea {
font: inherit; /* use the page's font and size */
color: inherit;
letter-spacing: inherit;
}
input, select, textarea, button { box-sizing: border-box; }
textarea { resize: vertical; }
With font: inherit, the test input became 18px Georgia. With an inherited size of 16px or more, this also stops iOS Safari zooming in on fields when they're focused.
appearance
appearance controls whether a control is drawn with its native look:
| Value | Effect |
|---|---|
auto (default) | the native look |
none | removes the native rendering, so the element can be styled like a normal box; behavior and semantics stay |
base-select | for <select>: an unstyled but fully stylable base appearance (see below) |
appearance: none on a checkbox removes the box and tick entirely: you draw them yourself, while keyboard support, :checked and form submission still work:
input[type="checkbox"] {
appearance: none;
inline-size: 1.25em; block-size: 1.25em;
border: 2px solid currentColor; border-radius: 0.3em;
display: inline-grid; place-content: center;
}
input[type="checkbox"]::before {
content: ""; inline-size: 0.65em; block-size: 0.65em;
clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0, 43% 62%); /* a tick */
background: currentColor; scale: 0; transition: scale 0.12s;
}
input[type="checkbox"]:checked::before { scale: 1; }
input[type="checkbox"]:focus-visible { outline: 2px solid; outline-offset: 2px; }
Checkboxes and radios accept ::before once their appearance is none. Tested in Chrome: the checkbox computed appearance: none and, with the reset's font: inherit on a 16px page, was 1.25em, or 20px, square.
Before rebuilding a control, try accent-color (article 34), which recolors checkboxes, radios, ranges and progress bars natively with one line: :root { accent-color: #8a3b12; }. And set color-scheme (article 34) so controls, scrollbars and pickers use dark styles on dark pages.
field-sizing: content
By default, an input has a fixed width (about 20 characters) and a textarea a fixed number of rows. field-sizing: content makes them size to their content instead:
textarea { field-sizing: content; min-block-size: 3lh; max-block-size: 12lh; } /* with border-box, these include padding and border */
input.tag { field-sizing: content; min-inline-size: 4ch; }
select.compact { field-sizing: content; }
Tested in Chrome:
- An input with
field-sizing: contentholding "hi" was 18px wide, against 153px for a normal input. With the value "a longer value", it was 92px. - A textarea was 21px tall with one line of text, 36px with two and 66px with four.
Always set a minimum size, because an empty field shrinks to almost nothing, or to its placeholder's size if it has one (tested in Chrome: 9px empty, 217px with the placeholder "Search destinations, hotels or tours"), and a maximum for textareas, after which they scroll. field-sizing works in Chrome 123, Safari 26.2 and Firefox 152.
Customizable <select>

Opting in with appearance: base-select on both the <select> and its ::picker(select) turns the select into normal, stylable boxes. The dropdown becomes a popover in the top layer, and options can contain markup, like icons:
<select class="fruit">
<button><selectedcontent></selectedcontent></button>
<option value="apple"><span class="icon">🍎</span> Apple</option>
<option value="banana"><span class="icon">🍌</span> Banana</option>
</select>
.fruit, .fruit::picker(select) { appearance: base-select; }
.fruit { border: 2px solid #8a3b12; border-radius: 10px; padding: 0.4rem 0.7rem; }
.fruit::picker-icon { transition: rotate 0.2s; }
.fruit:open::picker-icon { rotate: 180deg; }
.fruit::picker(select) { border-radius: 10px; padding: 0.3rem; box-shadow: 0 8px 24px rgb(0 0 0 / 0.15); }
.fruit option { border-radius: 6px; padding: 0.4rem; }
.fruit option:checked { font-weight: 700; }
.fruit option::checkmark { color: #8a3b12; }
The parts:
<button>as the first child replaces the closed control's contents.<selectedcontent>inside it shows a copy of the chosen option's content. Tested in Chrome, it contained "🍎 Apple", icon included.::picker-iconis the arrow.:openmatches while the picker is open.::checkmarkis the tick by the selected option.
Keyboard behavior, form submission and accessibility stay native. Tested in Chrome: CSS.supports('appearance', 'base-select') was true, and a select without the opt-in kept appearance: auto.
It works in Chrome 135 and Safari 27. Firefox 149 accepts appearance: base-select but doesn't yet support ::picker(select), <selectedcontent>, ::picker-icon or ::checkmark. Browsers without it show the ordinary native select, with markup inside options ignored except their text. That makes it a safe progressive enhancement.

The first two panels show why the reset comes first: the controls ignore the page's font until font: inherit is applied.
Other form pieces
| Feature | Article |
|---|---|
:user-invalid, :user-valid, :placeholder-shown, :checked, :disabled | 11 |
::placeholder, ::file-selector-button | 13 |
accent-color, color-scheme | 34 |
caret-color: #8a3b12 sets the text cursor color; caret-shape (Chrome 144) can make it a block or underscore | here |
Range sliders still need prefixed pseudo-elements for full styling: ::-webkit-slider-thumb and ::-webkit-slider-runnable-track in Chrome and Safari, ::-moz-range-thumb and ::-moz-range-track in Firefox, each with appearance: none on the input. Write them as separate rules, since a selector list with an unknown pseudo-element is dropped entirely (article 6).
Accessible form styling
- Labels: every control needs a visible
<label>. Placeholders aren't labels; they disappear when typing, and are usually low contrast. - Focus: never remove outlines without a replacement. Style
:focus-visiblewith at least a 2px indicator that contrasts with its surroundings. - Contrast: control borders and other parts needed to identify them need 3 contrast against the background (WCAG 1.4.11), and text 4.5.
- Size: targets of at least 24 × 24 CSS pixels (WCAG 2.5.8 AA), ideally 44px on touch screens.
- Errors: show errors with text and an icon, not only a red border, and style them with
:user-invalidso they appear after interaction. - Forced colors: Windows high contrast mode replaces backgrounds with system colors, so a tick drawn with
background, like the one above, can vanish while the border survives. Restore it with@media (forced-colors: active) { input[type="checkbox"]::before { background: CanvasText; } }.
body { font: 0.95rem/1.4 Georgia, serif; margin: 1rem; color: #2a2118; accent-color: #8a3b12; }
input, button, select, textarea { font: inherit; color: inherit; box-sizing: border-box; }
.form { display: grid; gap: 0.6rem; }
label { display: grid; gap: 0.2rem; }
label > span { font: 600 0.8rem system-ui, sans-serif; } /* only the label text */
input, textarea, select { border: 2px solid #b9a993; border-radius: 8px; padding: 0.3rem 0.5rem; background: white; }
:is(input, textarea, select):focus-visible { outline: 3px solid #8a3b12; outline-offset: 1px; }
.fruit, .fruit::picker(select) { appearance: base-select; }
.fruit { inline-size: 100%; }
.fruit::picker-icon { transition: rotate 0.2s; color: #8a3b12; }
.fruit:open::picker-icon { rotate: 180deg; }
.fruit::picker(select) { border: 2px solid #b9a993; border-radius: 8px; padding: 0.25rem; }
.fruit option { border-radius: 6px; padding: 0.3rem 0.4rem; }
.fruit option:hover { background: #f4efe6; }
.fruit option::checkmark { color: #8a3b12; }
.tag { field-sizing: content; min-inline-size: 5ch; justify-self: start; }
textarea { field-sizing: content; min-block-size: 2lh; max-block-size: 6lh; resize: none; }
.check { display: flex; align-items: center; gap: 0.5rem; }
.check input[type="checkbox"] {
appearance: none; margin: 0; inline-size: 1.2em; block-size: 1.2em; padding: 0;
border: 2px solid currentColor; border-radius: 0.3em; display: inline-grid; place-content: center;
}
.check input[type="checkbox"]::before {
content: ""; inline-size: 0.65em; block-size: 0.65em; background: currentColor;
clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0, 43% 62%);
scale: 0; transition: scale 0.12s;
}
.check input[type="checkbox"]:checked::before { scale: 1; }
The select opens a styled picker with icons; the tag input and the textarea grow with their content; the checkbox is rebuilt with appearance: none and a clipped tick; and the radio stays native, recolored by accent-color.
What's current
appearance: base-select,::picker(select)and<selectedcontent>: Chrome 135, Safari 27; Firefox 149 supports only thebase-selectvalue so far.field-sizing: Chrome 123, Safari 26.2, Firefox 152.:open: all browsers since Safari 26.5.caret-shape: Chrome 144.
Common questions
Why don't my inputs use the page font?
Controls don't inherit font settings by default. Add font: inherit.
How do I make a textarea grow with its content?
field-sizing: content, with min-block-size and max-block-size.
Can I style the dropdown of a <select>?
Yes, with appearance: base-select on the select and its ::picker(select). Older browsers show the native select.
Is appearance: none bad for accessibility?
No, the element keeps its role and keyboard behavior. Just make sure your replacement shows checked, focus and disabled states clearly.
Summary
- Reset controls with
font: inheritandbox-sizing: border-box. - Try
accent-colorandcolor-schemebefore rebuilding controls. appearance: nonelets you draw checkboxes and radios yourself, keeping their behavior.field-sizing: contentsizes inputs, textareas and selects to their content; set limits.appearance: base-selectwith::picker(select),<selectedcontent>,::picker-iconand::checkmarkmakes<select>fully stylable.- Keep labels, visible focus, 3 control contrast, 24px targets and text-based errors.
Practice questions
Inputs in your form look smaller than the surrounding text. What's the fix?
Answer
input, button, select, textarea { font: inherit; }
Controls use their own default font, about 13.33px, unless told to inherit.
Write CSS for a comment box that starts two lines tall, grows with its content, and scrolls after ten lines.
Answer
textarea.comment { field-sizing: content; min-block-size: 2lh; max-block-size: 10lh; }
Which two selectors need appearance: base-select to opt a select into full styling?
Answer
The <select> itself and its ::picker(select):
select, select::picker(select) { appearance: base-select; }
A designer wants brand-colored checkboxes. What's the simplest approach, and when would you need appearance: none?
Answer
accent-color: <brand color> recolors native checkboxes with one declaration. Use appearance: none and draw the box yourself only when you need a different shape, size or animation than the native control allows.
Review quiz
Test yourself on Part 14 with the CSS Part 14 review quiz.
Previous: Masking: mask-image, Luminance and Alpha Masks, and the mask Properties
Next: 2D Transforms: translate, rotate, scale, skew and the Individual Transform Properties

More in CSS Course
Quiz: CSS Delicate Details
Twenty-five questions on the edge cases that surprise experienced developers: invalid custom properties, shorthands that reset values, layer order with !important, containing blocks, margin collapsing, specificity of :is() and :where(), intrinsic minimum sizes, and more, each checked in Chrome.
Quiz: CSS Interview Questions
Thirty front-end interview questions: cascade, specificity and layers, box model and margin collapsing, stacking contexts, positioning, flexbox and grid, responsive design, custom properties, performance, accessibility, modern selectors and architecture.
Quiz: CSS Course Final Exam
Thirty questions across the whole CSS course: syntax and error handling, selectors, the cascade and layers, values and units, color, the box model, backgrounds, positioning, flexbox, grid, responsive design, typography, generated content, effects, transforms, motion and architecture.
Quiz: CSS Architecture, Tooling and Debugging (CSS Part 17)
Twenty questions on modular CSS and BEM, layering a stylesheet, design tokens and theming, pattern libraries and safe refactoring, preprocessors and build tools, the at-rules reference, and debugging common CSS problems.
Discussion
Sign in to ask a question or share what you learned.