1/* Traditional appearance: none approach */2select {3 appearance: none;4 -webkit-appearance: none;5 background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23007CB2%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4l128-127.9c3.6-3.6%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");6 background-repeat: no-repeat;7 background-position: right 0.7rem top 50%;8 background-size: 0.65rem auto;9 padding-right: 2.5rem;10}Inconsistent Cross-Browser Behavior
Different browsers interpret appearance: none differently, leading to inconsistent results across Safari, Firefox, and Chrome.
Limited Option Styling
Individual option elements cannot be fully styled in most browsers, even with custom selects.
Accessibility Concerns
Custom dropdowns built with hidden selects require additional JavaScript and ARIA attributes to maintain accessibility.
Mobile Limitations
Mobile browsers often ignore custom styling and show their native pickers for select elements.
1/* Enable base-select styling */2select,3select::picker(select) {4 appearance: base-select;5}6 7/* Custom dropdown arrow styling */8select::picker-icon {9 width: 1.5rem;10 height: 1.5rem;11 background-image: url("data:image/svg+xml,...");12}13 14/* Custom listbox styling */15select::picker(select) {16 background-color: white;17 border: 1px solid #e5e7eb;18 border-radius: 0.5rem;19 box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);20}::picker(select)
Targets the dropdown listbox that appears when the select is opened
::picker-icon
Targets the dropdown arrow icon inside the select button
::checkmark
Targets the indicator on the currently selected option
:open
Pseudo-class that targets the select when its dropdown is visible
1/* Base select styling */2select {3 appearance: base-select;4 width: 100%;5 max-width: 300px;6 padding: 0.75rem 2.5rem 0.75rem 1rem;7 font-size: 1rem;8 font-family: inherit;9 color: #374151;10 background-color: white;11 border: 2px solid #d1d5db;12 border-radius: 0.5rem;13 cursor: pointer;14 transition: border-color 0.2s ease, box-shadow 0.2s ease;15}16 17select:hover {18 border-color: #9ca3af;19}20 21select:focus {22 outline: none;23 border-color: #3b82f6;24 box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);25}1/* Custom listbox styling */2select::picker(select) {3 appearance: base-select;4 background-color: white;5 border: 1px solid #e5e7eb;6 border-radius: 0.5rem;7 box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1),8 0 4px 6px -2px rgba(0, 0, 0, 0.05);9 padding: 0.5rem;10 margin-top: 0.25rem;11}12 13/* Open state styling */14select:open::picker(select) {15 opacity: 1;16 transform: translateY(0) scale(1);17}1/* Custom dropdown arrow */2select::picker-icon {3 appearance: base-select;4 width: 1.25rem;5 height: 1.25rem;6 background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23374151' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");7 background-repeat: no-repeat;8 background-position: center;9 background-size: contain;10 opacity: 0.6;11}12 13select:hover::picker-icon {14 opacity: 1;15}1/* Option styling */2select option {3 appearance: base-select;4 padding: 0.75rem 1rem;5 border-radius: 0.375rem;6 cursor: pointer;7 transition: background-color 0.15s ease;8}9 10select option:hover {11 background-color: #f3f4f6;12}13 14select option:checked {15 background-color: #eff6ff;16 color: #1d4ed8;17}18 19/* Custom checkmark styling */20select option::checkmark {21 appearance: base-select;22 width: 1.25rem;23 height: 1.25rem;24 background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%233b82f6' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 11l-5-5'/%3E%3C/svg%3E");25 background-repeat: no-repeat;26 background-position: center;27 background-size: contain;28}29 30select option:not(:checked)::checkmark {31 opacity: 0;32}Keyboard Navigation
Arrow keys, Enter to select, Escape to close, Home/End for first/last options
Screen Reader Support
Role, label, and state are communicated automatically
Focus Management
Browser handles focus trapping and visibility
Mobile Accessibility
Touch-optimized interactions are maintained
1/* Clear focus indicators */2select:focus-visible {3 outline: 2px solid #3b82f6;4 outline-offset: 2px;5}6 7select:focus {8 border-color: #3b82f6;9 box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);10}1/* Modern browsers with base-select support */2@supports (appearance: base-select) {3 select {4 appearance: base-select;5 }6 7 select::picker(select) {8 /* Enhanced styling */9 }10}11 12/* Legacy browsers */13@supports not (appearance: base-select) {14 select {15 /* Basic styling that works everywhere */16 appearance: none;17 -webkit-appearance: none;18 }19 20 select {21 background-image: url("data:image/svg+xml,...");22 background-repeat: no-repeat;23 background-position: right 0.75rem center;24 padding-right: 2.5rem;25 }26}