picture-element
यह क्या करती है
यह स्किल प्रोजेक्ट के picture एलिमेंट की समीक्षा करती है और उन्हें ठीक करती है जिनमें img फ़ॉलबैक या ज़रूरी एट्रीब्यूट नहीं हैं। यह उन वेब बिल्डरों के लिए है जो आधुनिक फ़ॉर्मेट में इमेज परोसते हैं।
कब इस्तेमाल करें
- ✓जब आप एजेंट से प्रोजेक्ट के picture एलिमेंट में छूटे फ़ॉलबैक जाँचवाएँ।
- ✓जब कुछ ब्राउज़रों में कोई इमेज न दिखे और picture मार्कअप अधूरा हो।
- ✓जब आप आधुनिक इमेज फ़ॉर्मेट जोड़ रहे हों और शुरू से ही मार्कअप सही चाहते हों।
Skill का लिंक
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/picture-element/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“क्या आप मेरी साइट के picture एलिमेंट जाँच सकते हैं और जिनमें फ़ॉलबैक इमेज या alt टेक्स्ट नहीं है उन्हें ठीक कर सकते हैं?”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
एजेंट जाँचता है कि हर picture एलिमेंट एक img एलिमेंट पर खत्म हो, जिसमें alt, width और height एट्रीब्यूट हों। वह यह भी देखता है कि source एलिमेंट पहले आएँ, उनमें srcset या media मान हो, और फ़ॉर्मेट के लिए type हो। फिर वह जो हिस्से छूटे हों उन्हें जोड़ता है।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
Use <picture> with an <img> fallback
A <picture> without an <img> fallback renders nothing in browsers that don't support <picture> (IE11) or don't support any of the <source> formats. The <img> child is also where alt, width, height, loading, and fetchpriority attributes live—these apply regardless of which source the browser selects.
Quick Reference
- Every
<picture>must end with an<img>element—it is the required fallback and carriesalt <source>elements are evaluated top-to-bottom; the first match wins- Use
type="image/avif"andtype="image/webp"on<source>for format selection - The
<img src>should point to a JPEG or PNG—the universal fallback for all browsers
Check
Scan all <picture> elements in this codebase. Verify: 1) Every <picture> has an <img> as its last child (required fallback). 2) The <img> has an alt attribute. 3) The <img> has width and height attributes. 4) <source> elements appear before the <img> child. 5) Each <source> has either a srcset attribute or a media attribute. 6) format-selecting <source> elements have a type attribute (type="image/avif", type="image/webp"). Flag any <picture> missing an <img> child or with <img> not as the last child.
Fix
For each <picture> element with issues: 1) If missing <img>: add <img src="{fallback-url}" alt="{description}" width="{w}" height="{h}"> as the last child. 2) If <img> is not last: move it to after all <source> elements. 3) If <source> elements lack type attributes for format selection: add type="image/avif" or type="image/webp". 4) Verify the <img src> points to a universally supported format (JPEG or PNG) as the ultimate fallback. Show the corrected <picture> markup.
Explain
Explain how the <picture> element works. Browsers evaluate <source> elements in document order and use the first one whose conditions match (type, media, srcset). The <img> element is the fallback for browsers that don't support <picture> (IE11) or don't support the source format. Without an <img> child, <picture> is invalid HTML and produces no output. The alt attribute must be on the <img>, not the <source> elements—it applies regardless of which source is selected.
Code Review
Review image assets, markup, and delivery configuration related to Use <picture> with an <img> fallback. Flag exact files or components where format choice, sizing, or loading behavior violates the rule, and describe how to confirm the fix in DevTools.
For full implementation details, code examples, and framework-specific guidance,
see references/rule.md.
Rule page: https://frontendchecklist.io/rules/images/picture-element
अक्सर पूछे जाने वाले सवाल
img फ़ॉलबैक क्यों ज़रूरी है?
जो ब्राउज़र picture या सूचीबद्ध फ़ॉर्मेट सपोर्ट नहीं करते, उन्हें कुछ भी दिखाने के लिए img एलिमेंट चाहिए।
source एलिमेंट कैसे काम करते हैं?
स्किल के अनुसार उन्हें ऊपर से नीचे जाँचा जाता है और पहला मेल खाने वाला इस्तेमाल होता है।
alt और आकार के एट्रीब्यूट कहाँ जाते हैं?
स्किल कहती है कि वे img एलिमेंट पर होने चाहिए, जहाँ से चुना गया source भी लागू होता है।
जानकारी
लेखक का मूल विवरण
Use when reviewing image assets, markup, and CDN or build transforms related to Use <picture> with an <img> fallback. Check encoded size, rendered size, loading strategy, and above-the-fold impact together.
लोकप्रियता
- GitHub स्टार
- 75k
- रैंकिंग में स्थान
- #2979
- लाइसेंस
- MIT
- अपडेट की गई
- 31/10/2026
कमेंट
- …
इस repository की और skills
frontendchecklist
75kकमांड-लाइन टूल से फ़्रंटएंड कोड और लाइव पेजों को एक्सेसिबिलिटी, स्पीड, SEO और सिक्योरिटी के 380 से ज़्यादा नियमों से जाँचती है।
frontend-checklist-global
75kफ़्रंटएंड प्रोजेक्ट को Front-End Checklist के सभी 386 नियमों से ऑडिट करती है, और हर मिली समस्या का ठोस समाधान देती है।
404-page
75kजाँचती है कि आपका गुम पेज उपयोगी लिंक देता है और सही 404 स्टेटस लौटाता है, ताकि भटके हुए विज़िटर रास्ता ढूँढ सकें।
about-page
75kजाँचती है कि आपकी साइट पर एक साफ़ About पेज है जो बताता है कि उसे कौन चलाता है, ताकि विज़िटर और सर्च इंजन का भरोसा बढ़े।
मिलती-जुलती skills
gifgrep
394kयह आपके एजेंट को GIF लाइब्रेरी में खोजने, नतीजों का पूर्वावलोकन करने, GIF डाउनलोड करने, और उससे एक फ़्रेम या फ़्रेम्स की शीट निकालने देती है।
meme-maker
394kयह आपके एजेंट को मीम टेम्पलेट चुनने, अपने कैप्शन जोड़ने और मीम को SVG या PNG इमेज के रूप में बनाने देती है।
ios-icon-gen
280kआपके एजेंट को iOS ऐप्स के लिए icons बनाने देता है। यह Apple symbols या दूसरे स्रोतों के आइकन इस्तेमाल करके सही files बनाता है।