HTML Customizable Select and Selectedcontent
Start with the native select
A traditional select is a reliable baseline for a fixed choice. Give options meaningful text and explicit submission values. It provides browser-managed keyboard and selection behavior without building a custom widget.
<label> Plan <select name="plan"> <option value="basic">Basic</option> <option value="pro">Pro</option> </select></label>Basic is selected initially. The submitted value is basic.
A richer option and selected display
Newer customizable dropdown select features allow richer option markup. An optional first child button containing selectedcontent displays a clone of the selected option content in supporting browsers. Keep text in each option so a native fallback is still meaningful. This is a progressive enhancement, not a universal feature.
<label> Delivery <select name="delivery"> <button> <selectedcontent></selectedcontent> </button> <option value="standard"> <span>Standard</span> </option> <option value="express"> <span>Express</span> </option> </select></label>The two option values remain standard and express. The enhanced display is browser-dependent.
Opt in with CSS and retain fallback
For customizable dropdowns, opt in using appearance: base-select on both the select and its picker pseudo-element. This CSS is introduced here only to demonstrate the HTML feature. Unsupported engines can ignore the new CSS. The button and option descendants must not contain interactive controls; retain the native keyboard behavior and verify the enhanced UI across target browsers.
<style> select { appearance: base-select; } select::picker(select) { appearance: base-select; }</style><label> Theme <select> <button> <selectedcontent></selectedcontent> </button> <option value="light"> <span>Light theme</span> </option> <option value="dark"> <span>Dark theme</span> </option> </select></label>Supporting browsers can render the enhanced dropdown; a conventional text menu remains the fallback goal.
Common mistakes and practice
Check compatibility for selectedcontent, appearance: base-select, and the picker pseudo-element individually. Do not insert duplicate IDs or interactive descendants into cloned option content. Test keyboard, accessibility and the fallback rather than assuming the enhanced structure works everywhere.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
HTML Customizable Select and Selectedcontent — Knowledge Check
Apply the control concepts taught in this lesson.
What is selectedcontent used for?
What is the recommended starting point?
What must be checked before requiring enhanced styling?
Why retain ordinary option text in an enhanced select?
Does recognition of appearance: base-select prove every customizable select feature works?