CSS Reference ยท Scrolling, Interaction and UI
The appearance property
Reference for the CSS appearance property: remove the native look of checkboxes, selects and buttons so you can restyle them, and keep them accessible.
The appearance property controls whether a form control is drawn by the operating system's widget toolkit or by plain CSS. With appearance: none, the native look disappears and the element becomes a styleable box, while its behavior (clicking, checking, keyboard use, form submission) stays the same.
It is the usual first step when you build custom checkboxes, radio buttons, select menus or range sliders without replacing the real <input> with a pile of <div> elements.
input[type="checkbox"] { appearance: none; }
Try it
The custom boxes are still real checkboxes: click them, or Tab to one and press Space.
Syntax
appearance: none | auto | <compat-auto> | <compat-special>
- Initial value:
none - Applies to: all elements
- Inherited: no
- Animatable: no
- Computed value: as specified
Values
| Value | Description |
|---|---|
none |
Disables the native widget look. The element is drawn with ordinary CSS boxes, borders and backgrounds. |
auto |
The element gets its normal native look, if it has one. On elements that have no native look it behaves like none. |
Compat keywords such as button, textfield, menulist, checkbox, radio |
Legacy values kept so old style sheets keep working; in current browsers they mostly behave like auto. Avoid them in new code. |
A newer value, base, together with the related base-select for <select>, is designed to opt controls into a baseline that is easy to restyle completely. It is new and support is limited, so check a compatibility table before using it.
Usage notes
- Reset first, then rebuild. After
appearance: none, the control often loses its size and focus ring. Set a size, border, background and your own:focus-visiblestyle, as in the example. - Pseudo-elements on inputs. Once
appearance: noneis set,::beforeand::afterwork on checkboxes and radio buttons in current browsers, which is how the check mark above is drawn. Do not rely on this for text fields. - Keep the real element. Because the
<input>stays in place, labels, form submission, validation and assistive technology keep working. This is better than hiding the input and faking one with<div>elements. - Check high contrast mode. In forced colors mode the system overrides many colors. A custom checkmark made only of a background color can vanish, so use borders or text colors that survive, or check how it looks.
- Selects.
appearance: noneon a<select>removes the arrow. You must supply your own, as in the second example. The pop-up list itself is still controlled by the browser unless you use the newer customizable select features. - Prefixes. Older code writes
-webkit-appearanceand-moz-appearance. The unprefixed property is supported everywhere now; keep the prefix only for very old browsers. - Use
accent-colorfirst if all you want is a different highlight color.
Browser support
The unprefixed appearance: none and auto work in all current browsers; the newer base values have limited support.
Related
accent-colorโ recolor native controlscolor-schemeโ light and dark control renderingoutlineโ focus rings::beforeโ generated content for custom marks- Lessons: Forms, User Interface