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

css-grid

できること

このスキルは、行と列の両方が必要なレイアウトにCSS Gridを使う方法を説明します。少ないコードでレスポンシブなレイアウトを作りたいフロントエンド開発者向けです。

使う場面

  • ✓行と列が揃って並ぶ必要があるレイアウトを作るとき。
  • ✓floatやflexの回避策が、画面サイズによって壊れるとき。
  • ✓多くのメディアクエリを使わずに、レスポンシブなカードのグリッドが欲しいとき。

スキルのリンク

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

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

使い方

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

貼り付け用メッセージ

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

AIへの頼み方の例

“私の商品一覧を、画面の幅に合わせて変わるレスポンシブなグリッドに作り直してください。”

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

仕組み

エージェントは、グリッドのトラックと名前付きの領域を設定し、レスポンシブな列にはminmaxとauto-fillを使い、入れ子の項目を親に揃える必要がある場合はsubgridを使います。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

Use CSS Grid for two-dimensional layouts

CSS Grid solves layout problems that previously required JavaScript or complex CSS hacks — aligning items across both axes simultaneously, creating named layout areas, and building responsive grids that adapt to content. Using Flexbox for two-dimensional layouts results in workarounds like fixed widths that break responsiveness.

Quick Reference

  • Use Grid for two-dimensional layouts (rows AND columns); use Flexbox for one-dimensional
  • grid-template-areas provides a visual representation of the layout in your CSS
  • minmax() and auto-fill/auto-fit create responsive grids without media queries
  • Subgrid allows nested elements to align to the parent grid's tracks

Check

Look for float-based or Flexbox layouts in this CSS that are trying to control both rows and columns — they may be better implemented with CSS Grid.

Fix

Convert this two-dimensional layout to use CSS Grid with appropriate grid-template-columns, grid-template-rows, and grid-template-areas.

Explain

Explain CSS Grid fundamentals: tracks, cells, areas, fr units, minmax, and auto-fill vs auto-fit.

Code Review

Review stylesheets, component styles, and responsive states related to Use CSS Grid for two-dimensional layouts. 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-grid

よくある質問

FlexboxではなくGridを使うべきなのは、いつですか?

行と列を同時に持つ二次元のレイアウトにはGrid、一方向のレイアウトにはFlexboxを使うと、このスキルは説明しています。

subgridとは何ですか?

入れ子の要素を、親のグリッドのトラックに揃えられるようにする機能だと、このスキルは説明しています。

メディアクエリなしでグリッドをレスポンシブにできますか?

はい。auto-fillまたはauto-fitを使ったminmaxで、レスポンシブなグリッドを作れると、このスキルは説明しています。

詳細

作者による元の説明

Use when reviewing stylesheets, component styles, and responsive behavior related to Use CSS Grid for two-dimensional layouts. Check the rendered layout across breakpoints and interaction states before proposing a fix.

repo: thedaviddias/Front-End-Checklist

人気

GitHubのスター
75k
ランキング
#2799
ライセンス
MIT
更新日
2026/10/31

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

0

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

コメント

  • …

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

似ているスキル