AI summary
工具:精选样式样本。我对 HTML <select> 框在不同浏览器中默认外观不同感到沮丧,而且(我认为)它们在 Chrome 里相当难看:所以我让 Claude Fable 5.2 为我构建了这个页面,展示它们所有可以被样式化的方式:构建一个 HTML 页面,展示 select 框所有可以被样式化的方式,我计划在每个桌面和移动浏览器中截图。经过一些实验,我决定我最喜欢的 select 框 CSS 是这样的:select { appearance : none ; color : # 1f2933 ; padding : 0.5 em 2.25 em 0.5 em 0.75 em ; border : 1 px solid # c4cbd3 ; border-radius : 6 px ; 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.75 em center / 0.75 em ; } 这是它在三个浏览器中的样子:标签:tools , css , html
Translation(model translation, not the source's own text)
Select 样式样本 HTML 的 <select> 下拉框在不同浏览器里默认外观各不相同,这让我很困扰,而且(我认为)它在 Chrome 里相当难看:
同一个下拉框在 Chrome、Safari 和 Firefox 中的样子:Chrome 是白底黑边框,Safari 是灰底无边框,Firefox 是灰底黑边框。三者尺寸都略有不同。 于是我让 Claude Fable 5.2 帮我做了这个页面,展示下拉框所有可能的样式:
做一个 HTML 页面,展示 select 下拉框所有可以实现的样式,我打算在每个桌面端和移动端浏览器里截图 经过一些尝试后,我决定我最喜欢的 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;
}
下面是它在三个浏览器里的效果:
现在下拉框在三个浏览器里完全一致——每个都是圆角的灰色边框,右侧有一个灰色向下的箭头。
The translation is machine-generated and individual terms may be off. Nothing is rewritten or cut; the original is authoritative.
Published by Simon Willison
This site only summarises and aggregates; copyright stays with the original author. Headlines and summaries follow the source — where they differ, the original wins.
Read the original ↗