跳到正文
Skillpedia
图片与图标75k · #2997

responsive-images

它能做什么

这个技能检查网站的图片标记,并在缺少或有误的地方添加或修正 srcset 和 sizes 属性。它面向在不同屏幕上以不同尺寸显示图片的网站构建者。

适用场景

  • ✓你请智能体让图片为每种设备加载合适尺寸的时候。
  • ✓手机下载大型桌面图片,导致加载感觉很慢的时候。
  • ✓你在构建文章卡片、图库或其他以多种宽度显示图片的组件的时候。

技能链接

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/responsive-images/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/responsive-images/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“我的网站给手机发送了很大的图片。请帮我设置响应式图片,让每种设备都获得合适的尺寸吗?”

每周 5 个新技能,1 分钟读完。

工作原理

智能体会添加包含多种宽度的 srcset,以及与真实布局相符的 sizes 属性。这样浏览器就能为每个屏幕和像素密度选择最小的合适文件。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Implement responsive images with srcset

Serving a 2000px image to a 400px phone screen wastes bandwidth and slows loading—srcset lets the browser download only the size it needs.

Quick Reference

  • Use srcset to provide multiple image sizes
  • Use sizes attribute to tell browser which size to download
  • Browser selects optimal size based on viewport and DPR
  • Can save 50-70% bandwidth on mobile devices

Check

Verify that images use srcset and sizes attributes for responsive delivery.

Fix

Implement responsive images with srcset for different screen sizes and resolutions.

Explain

Explain how responsive images deliver optimized versions based on device capabilities.

Code Review

Inspect image markup and component abstractions for srcset, sizes, and width/height handling. Flag pages that always ship desktop-sized assets to mobile, omit sizes, or generate variants that do not match the actual rendered layout.


For full implementation details, code examples, and framework-specific guidance, see references/rule.md.

Rule page: https://frontendchecklist.io/rules/images/responsive-images

常见问题

如果 sizes 写错了会怎样?

这个技能说,错误的 sizes 属性会抵消 srcset 的好处,因为浏览器可能会选中过大的文件。

我需要制作多个图片版本吗?

需要。srcset 需要同一图片的多个尺寸,智能体可以帮忙生成。

这对流量有帮助吗?

这个技能说,它可以为移动设备节省大量流量。

详情

作者的原始描述

Use when reviewing article images, cards, galleries, or any component rendered at multiple sizes across breakpoints. Check both the markup and the CSS layout because an incorrect `sizes` attribute can negate a perfectly good `srcset`.

repo: thedaviddias/Front-End-Checklist

热度

GitHub 星标
75k
排名
#2997
许可证
MIT
更新时间
2026/10/31

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能