Grid – Proper layout organisation.

written by N. Stevanović

What is Grid?

Grid is a very useful CSS tool.  It is a two-dimensional system for website layout organisation and it helps a lot to present and place elements on it.  It can be compared to flexbox which is a one-dimensional system. The one-dimensional layout has elements in one row or column, and in a two-dimensional system elements have to be arranged in various columns or rows. Otherwise, both systems are better than the old ways of arranging layouts. The old way involved the use of float and in-line block options, within which the appearance of a website was often very uncertain. By using the Grid tool, you can solve layout problems and develop your website more efficiently. 

When Do We Use It?

In most cases, Grid is combined with a flexbox tool. This combination can improve the whole layout organisation through the website development process. 


  • In the picture below we have one container with container class and child elements (elements contained in a container) called item.

container class and item

  • We need to adjust the CSS by setting display: grid

display:grid code

  • After container making, the next step would be to put sizes for columns and rows by using grid-template-columns and grid-template-rows options. Please note that here the sizes in pixels are given arbitrarily, while in a specific code you have to enter the exact pixel size for each row and column so that the layout turns out as you imagined. 

grid template column and row

  • Setup of child elements by using grid-column and grid-row would look like this:

grid column grid row setup


This completes the initial creation of the container with the grid elements and you get a nicely planned layout of the site. As with flexbox, the way grid elements are arranged is not crucial because CSS itself allows their reallocation. This is why creating a mobile layout application is much easier, because, through just a few lines of code in CSS, a grid layout made for a desktop can be adapted to a mobile one.  

When Can it Be Difficult to Use Grid?

Problems can occur if older versions of browsers that don’t support Grid are used. Fortunately, there is a Can I use website so that can be easily checked. Whether you are a beginner or an experienced programmer, you should carefully study the documentation before using this tool to avoid making any room for possible errors. 


Quantox- Using CSS Grid for Better Results!

Quantox has the best way of implementing complex design layouts with CSS Grid. Masters of all trades, we know what to use and when to use it for incredible web development results that will promote and boost your business. No web design is to complicated for Quantox. Let’s Talk!