Simon Willison 10天前 · 2026-11-23 15:25:56 · 17 阅读
HTML Select 下拉框样式统一方案
Tool
Select Styling Specimens
HTML <select> 下拉框在不同浏览器里默认样式不一致,这让我很不爽,而且在 Chrome 里(我觉得)相当难看:

于是我用 Claude Fable 5.2 生成了这个页面,展示了下拉框各种可用的样式方案:
Build an HTML page that shows all of the ways a select box can be styled, I plan to take screenshots in every desktop and mobile browser
一番尝试之后,我确定了自己最喜欢的 select 下拉框 CSS 写法:
select {
appearance: none;
color: #1f2933;
padding: 0.5em 2.25em 0.5em 0.75em;
border: 1px solid #c4cbd3;
border-radius: 6px;
background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23667085' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 0.75em center / 0.75em;
}
下面是三个浏览器中的效果:

原始来源: Simon Willison