跳到正文
Simon Willison·· 13 天前精选

Willison分享AI辅助样式选型:生成对照页,再比较浏览器表现

AI 导读

Simon Willison让Claude Fable 5.2生成HTML下拉框的样式对照页,公开提示词、成品与最终CSS,并展示Chrome、Safari和Firefox的效果对比。读者可复用这种做法,让AI先生成可比较的候选,再用实际浏览器检查差异。

推荐理由

提供具体提示词和公开成品,适合前端样式选型。原文正文+原站 RSS 时间核验;浏览器效果为作者展示,本轮未独立复测。

正文 · AI 翻译

HTML <select> 框在不同浏览器中默认呈现不同的样式,这让我很烦,而且(我觉得)它们在 Chrome 中相当难看:

The same select box in Chrome, Safari, and Firefox, Chrome is white with a black border. Safari is grey with no border. Firefox is gray with a black border. They are all slightly different sizes.

所以我让 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

经过一些尝试,我决定将下面这段 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;
}

下面是它在这三个浏览器中的效果:

Now the select box is the same in all three browsers - it has a rounded corner grey border and a grey downward facing arrow in each one.

来源:Simon Willison · simonwillison.net