CSS GridA grid can be defined as an intersecting set of horizontal lines and vertical lines. CSS Grid layout divides a page into major regions. It defines the relationship between the parts of a control built from HTML primitives in terms of layer, position, and size. Grid property offers a grid-based layout system having rows and columns. It makes the designing of web pages easy without positioning and floating. Similar to the table, it enables a user to align the elements into rows and columns. But compare to tables, it is easy to design layout with the CSS grid. We can define columns and rows on the grid by using grid-template-rows and grid-template-columns properties. The CSS grid property is supported in browsers such as Google Chrome, Internet Explorer, Firefox, Safari, and Opera. Grid ContainerWe can define the grid container by setting the display property to grid or inline-grid on an element. Grid container contains grid items that are placed inside rows and columns. Let's see a simple example of a grid in CSS. ExampleTest it NowLet's see some of the shorthand properties:
In the following example, we are including some of the above shorthand properties. Now, let's see the example of using some properties: ExampleTest it NowThe justify-content propertyIt is used to align the entire grid within the container. It includes values such as:
Note: It is noted that the total width of the grid should be less than the width of the container for any effect of the justify-content property.Let's understand this property along with the values by using an example. ExampleTest it NowThe align-content propertyIt is used to align the entire grid within the container vertically. Note: It is noted that the total height of the grid should be less than the height of the container for any effect of the align-content property.The values of the align-content property are the same as the values of the justify-content property.
Next TopicCSS Layout
|