CSS: CSS Grid Practice

Last updated: 2026-10-13

1. 12-Column Grid System

The 12-column grid is a classic layout system in web development. Here's how to implement it with CSS Grid:

▶ Example

▶ Try it Yourself

2. Common Layout Patterns

(1) Holy Grail Layout

The most common page layout pattern:

▶ Example

▶ Try it Yourself

(2) Responsive Card Grid

▶ Example

▶ Try it Yourself

❓ FAQ

Q Why do grid systems use 12 columns?
A 12 is divisible by 2, 3, 4, and 6 — maximum flexibility. You can create 1/2, 1/3, 1/4, 1/6, 2/3, 3/4 proportions. Bootstrap and other frameworks use 12-column grids — it's the industry standard.
Q Hand-written grid vs Bootstrap grid?
A Hand-writing helps you understand the principles; Bootstrap is a packaged implementation. Real projects use Bootstrap for efficiency, but understanding principles helps when frameworks don't meet specific needs.
Q Flex grid vs Grid grid — which is better?
A Each has strengths. Flex suits one-dimensional arrangements but can't align across rows. Grid has stronger two-dimensional capabilities. For simple row distribution, Flex is enough; for grid-line alignment, use Grid.

📖 Summary

📝 Exercises

  1. Implement a complete 12-column grid system, create an HTML page showing different column combinations (3-3-3-3, 4-4-4, 2-8-2, etc.).
  2. Use responsive grid to show single column on mobile, two on tablet, four on desktop.
  3. Use col-offset-3 to center a content block on the page.
  4. Re-implement the 12-column grid using Grid, compare code differences.
Web-Tutorial.com

Web-Tutorial Tech Team

A team of developers maintaining programming tutorials. Each tutorial is written and reviewed by developers with expertise in that field. We work to keep our content accurate and reliable — if you spot an issue, please let us know.

100%

🙏 帮我们做得更好

我们是刚上线的编程教程站,几个人的小团队,精力有限。页面虽经检查,难免还有疏漏——链接失效、排版错乱、内容有误、语言生硬……

如果您发现了,麻烦告诉我们,我们会在收到反馈后第一时间进行修复,再次感谢您的光临 🙏