本文へスキップ
Skillpedia
WebサイトとUI(フロントエンド)75k · #2795

css-containment

できること

このスキルは、containプロパティとcontent-visibilityを使って、特定のコンポーネントが自己完結していることをブラウザに伝える方法を示します。コンポーネントが多いページが遅く感じられる開発者向けです。

使う場面

  • ✓独立したコンポーネントが多いページの更新が遅く感じられるとき。
  • ✓長いリストが、画面の外にあるコンテンツを描画しているとき。
  • ✓ウィジェットがはみ出さず、ページの他の部分に影響する必要がないとき。

スキルのリンク

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

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/css-containment/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“私の長い商品リストはスクロールすると重く感じます。画面の外の項目が描画の負担を減らすように、containmentを追加してください。”

毎週5つの新しいスキル。1分で読めます。

仕組み

エージェントは、自己完結したコンポーネントに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
更新日
2026/10/31

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル