
} Note: The height of the rows is tied to the viewport width, so that the cells maintain its aspect ratio perfectly fine. In our example, I have given the value of 15px to make our grid look better. The value for grid gap can be any CSS length unit.


We can create a grid of other sizes also but that depends on the type of gallery you want. For example: Above is a gallery of images with images of varying width and height which is a perfect use case for CSS grids. You can achieve the same functionality very quickly using CSS Grids. Image galleries made by websites like Unsplash, Pinterest Etc, are made by techniques like positioning or translating the image item which is a very cumbersome task to do.
