Skip to content

Select styles with CSS only - JS Bin

Updated: at 08:31 PM

Styling selects is a dirty business but Todd Parker has some beautiful examples

How this works: This styles a native select consistently cross-platform with only minimal CSS. The native select is then styled so it is essentially invisible (no appearance, border, bg) leaving only the select’s text visible. There is a wrapper around the select that has the majority of the button styles (gradient, shadow, border, etc.). We then add the custom arrow via a pseudo element to the right.

Firefox doesn’t allow you to consistently style away the select arrow so we’re setting the select width to 110% and clipping it with overflow:hidden on the parent. We then add extra right padding on the native select so the text won’t run over the custom arrow or be clipped by the wrapper. These style rules are targeted to Firefox with some pretty ugly scoping but it lets better browsers have a cruft-free experience. Older IE and Opera fall back to the native select.

View demo at jsbin.com