Selects, checkboxes, range and meters
Definition and purpose
Native selects, checkbox and range controls, progress and meter elements have browser-defined rendering and behavior. Prefer native controls so keyboard and accessibility features remain available. A progress bar reports completion; a meter represents a scalar measurement within a known range.
Native accent
<!doctype html><html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>CSS practice</title> <style> body { margin: 0; font: 16px sans-serif; color: #172033; background: white; } #a, #b, #p { accent-color: green; } </style> </head> <body> <label> <input id="a" type="checkbox" checked> Updates </label> <label> Volume <input id="b" type="range"> </label> <label> Plan <select id="s"> <option>Basic</option> <option>Pro</option> </select> </label> <label> Progress <progress id="p" value="3" max="10">30%</progress> </label> </body></html>Computed accent color is green; native painting may vary.
Syntax and mental model
accent-color supplies a preferred tint for applicable states of checkboxes, radio buttons, ranges and progress bars; the user agent may adapt the actual painted colors. Selects can use font and sizing rules; native popup styling varies. Customizable selects using appearance: base-select need support checks and a native fallback.
Readable select
<!doctype html><html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>CSS practice</title> <style> body { margin: 0; font: 16px sans-serif; color: #172033; background: white; } #s { font: inherit; width: 120px; } </style> </head> <body> <label> <input id="a" type="checkbox" checked> Updates </label> <label> Volume <input id="b" type="range"> </label> <label> Plan <select id="s"> <option>Basic</option> <option>Pro</option> </select> </label> <label> Progress <progress id="p" value="3" max="10">30%</progress> </label> </body></html>The closed select uses the declared width and font.
Common mistakes
Do not infer the actual painted checkmark color from computed accent-color. Removing appearance can remove the checked indicator; retain it unless you implement and test a replacement.
Practice and next steps
After trying the examples, complete the linked coding exercise and review questions. Predict the result before running your code. Prerequisite: Placeholder and file controls. Next lesson: Dialogs and popovers.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Selects, checkboxes, range and meters — knowledge check
Five questions on selects, checkboxes, range and meters.
Which property supplies a native tint?
Which element indicates task completion?
What does meter describe?
Why retain native appearance?
Does computed accent-color guarantee exact painted pixels?