Register to get access to free programming courses with interactive exercises

Introduction CSS: Layout on the Grid

Now you're acquainted with positioning and Flex, you might have noticed that with all the variety of tools available, it's not as easy to use these tools to directly create layouts as you'd like. By adding so many techniques, Flex has missed the most important thing: creating a grid for a site quickly. To create a good structure, you have to do additional nesting, because Flex is essentially a one-dimensional system. We can easily manage content on either the x-axis or the y-axis. This is great when working with content, but not when creating page structure.

Flex was intended to change layout standards, ridding developers of awkward positioning and endless suffering from float. Even though it does that perfectly well, there's still one main problem, what do you do with complex patterns? The number of flex containers grew in proportion to the number of non-standard elements. However, managing all this got much more difficult. Without a clear web page grid structure all described in one place, everything is unbelievably fragile. It's liable to break faster than you can blink.

CSS Grid Layout (often simply abbreviated to Grid) is another powerful tool, it was created to solve this problem. CSS Grid Layout unlike Flex, is a two-dimensional layout system for content on the page.

It's important to note that: Grid s not a replacement for Flex nor was it created for that purpose. These are two different modules that work perfectly together.


Many of the lessons in this course will include a practice section with web view. Try not to simply do the task, but rather, when you're done, have a go and experiment a little with the code and the features you've learned.

During the course, you'll come across independent assignments. If necessary, you can use the tasks in the assignments to practice. They'll also have code samples that you can have a look at for clues or simply study them.


Another opportunity to apply the skills you learn in the course is to use CodePen. You can create your own pen, and use it to experiment with positioning.

Also, in each lesson of the course, there'll be examples that are loaded from CodePen. They're available for review, and you can make edits in real time and monitor the result. Don't miss out on this opportunity.

Hexlet Experts

Are there any more questions? Ask them in the Discussion section.

The Hexlet support team or other students will answer you.

About Hexlet learning process

For full access to the course you need a professional subscription.

A professional subscription will give you full access to all Hexlet courses, projects and lifetime access to the theory of lessons learned. You can cancel your subscription at any time.

Get access
hours of theory

Sign up

Programming courses for beginners and experienced developers. Start training for free

  • 130 courses, 2000+ hours of theory
  • 1000 practical tasks in a browser
  • 360 000 students
By sending this form, you agree to our Personal Policy and Service Conditions

Our graduates work in companies:

<span class="translation_missing" title="translation missing:">Bookmate</span>
<span class="translation_missing" title="translation missing:">Healthsamurai</span>
<span class="translation_missing" title="translation missing:">Dualboot</span>
<span class="translation_missing" title="translation missing:">Abbyy</span>
Suggested learning programs
Layout with the latest CSS standards
5 months
from scratch
under development
Start at any time

Use Hexlet to the fullest extent!

  • Ask questions about the lesson
  • Test your knowledge in quizzes
  • Practice in your browser
  • Track your progress

Sign up or sign in

By sending this form, you agree to our Personal Policy and Service Conditions
Toto Image

Ask questions if you want to discuss a theory or an exercise. Hexlet Support Team and experienced community members can help find answers and solve a problem.