Skillpedia
المواقع والواجهات (frontend)75k · #2795

css-containment

ما الذي تفعله

تشرح هذه المهارة كيفية إخبار المتصفح بأن مكونات معينة مستقلة بذاتها، باستخدام خاصية contain وcontent-visibility. وهي موجهة إلى المطورين الذين تبدو صفحاتهم بطيئة بسبب كثرة المكونات.

متى تستخدمها

  • ✓عندما تبدو صفحة فيها مكونات كثيرة مستقلة بطيئة في التحديث.
  • ✓عندما تعرض القوائم الطويلة محتوى خارج الشاشة.
  • ✓عندما يكون لعنصر واجهة صغيرة ليس فيه تجاوز ولا يحتاج إلى التأثير في باقي الصفحة.

رابط المهارة

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

انسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.

طريقة الاستخدام

أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.

رسالة جاهزة للصق

استخدم هذه المهارة لمساعدتي: https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/css-containment/SKILL.md اقرأ ملف SKILL.md في هذا الرابط ونفّذ تعليماته لمهمتي.
تريد أن يجد الذكاء الاصطناعي مهارات مثل هذه بنفسه؟ثبّت خادم Skillpedia MCP المجاني: سطر واحد، ويبحث في 15,000+ مهارة قبل كل مهمة.ثبّته في دقيقة واحدة →

مثال على ما تطلبه من الذكاء الاصطناعي

“قائمة المنتجات الطويلة عندي تبدو بطيئة عند التمرير. أضف الاحتواء حتى تُعرض العناصر الخارجة عن الشاشة بجهد أقل.”

5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.

كيف تعمل

يضيف الوكيل قيم contain للمكونات المستقلة، وcontent-visibility بقيمة auto لعناصر القائمة المتكررة خارج الشاشة، بعد التحقق من أنها لا تفيض ولا تؤثر في جيرانها.

المحتوى التقني (ملف SKILL.md الأصلي)

النص الأصلي من المؤلف، مباشرة من GitHub.

Use CSS containment to limit repaint scope

By default, a CSS change anywhere on the page can potentially affect any other element's layout. CSS containment declares that certain elements are isolated — changes inside them don't affect the outside world. This lets browsers skip large portions of the rendering pipeline for unchanged content, which is especially valuable for pages with many independent components.

Quick Reference

  • contain: layout style paint tells the browser a component is visually self-contained
  • content-visibility: auto skips rendering off-screen content entirely
  • Containment limits how far layout recalculations need to propagate
  • Use contain: strict for widgets with no overflow that shouldn't affect the page

Check

Identify components in this CSS that are visually self-contained (no overflow, no interaction with elements outside) and could benefit from CSS containment.

Fix

Add appropriate contain values to self-contained components. Add content-visibility: auto to repeated off-screen list items.

Explain

Explain CSS containment values, how they limit rendering scope, and when content-visibility: auto provides the biggest benefit.

Code Review

Review stylesheets, component styles, and responsive states related to Use CSS containment to limit repaint scope. Flag exact selectors, declarations, or breakpoints that violate the rule in the rendered UI.


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

Rule page: https://frontendchecklist.io/rules/css/css-containment

الأسئلة الشائعة

ماذا تفعل contain؟

تقول المهارة إنها تخبر المتصفح بأن المكون مستقل بصريًا، فيبقى عمل التخطيط داخله.

ماذا تفعل content-visibility بقيمة auto؟

تقول المهارة إنها تتخطى رسم المحتوى خارج الشاشة.

متى تُستخدم contain بقيمة strict؟

للعناصر التي لا تفيض ولا يجب أن تؤثر في باقي الصفحة.

التفاصيل

الوصف الأصلي من المؤلف

Use when reviewing stylesheets, component styles, and responsive behavior related to Use CSS containment to limit repaint scope. Check the rendered layout across breakpoints and interaction states before proposing a fix.

repo: thedaviddias/Front-End-Checklist

الشعبية

نجوم GitHub
75k
الترتيب
#2795
الترخيص
MIT
آخر تحديث
31‏/10‏/2026

هل هذه المهارة مفيدة؟

0

سجّل الدخول للتصويت.

التعليقات

  • …

المزيد من المهارات من هذا المستودع

مهارات مشابهة