CSS Grid Layout Grid tutorial

Source: Internet
Author: User

Grid, really layout artifacts. After the introduction of two modules of Flex layout and Grid layout, Css really had the concept of layout. The original table layout did not know that it was a god of ghosts, and then float to the sky, you might also use abosulte to achieve the layout of the page. In short, it is particularly awkward to implement. Always pay attention to it: Will it collapse when I write it, and will it affect the elements behind it? Why does Nima still collide. The author boldly calls these implementations layout tricks, and Flex and Grid are the real cloth. Bureau. Flex is responsible for one-dimensional layout, and Grid is responsible for two-dimensional layout. Both layouts are very powerful, but one is more difficult than one, and the attributes are so much that you want to vomit blood. Who makes people the most important is modules rather than attributes. Today we will only introduce the concepts related to Grid layout

Grid container
Where grid layout starts, the carrier of the grid module. From the outside, it seems to be a block or an inline-block block, and the inside of the container is one by one. Like the Flex layout, it also has container properties and project properties.

Gridlines
There are horizontal and vertical grid lines. The criss-cross lines cut the grid container into the smallest unit cells. The grid lines are numbered, starting with the number 1. There are 6 horizontal lines and 6 vertical lines. You can also name the line if you like, and a line can have multiple names.

Cell
The green background block in the Grid Cell diagram is the cell. The smallest unit of measurement for the grid layout is 25 cells.

Grid track
The middle part of two adjacent grid lines is a track. Why should we have the concept of a track? Because the width of the track needs to be set, if the width and height are set separately on the cells, it may become a waterfall flow complex. The degree rises in a swish. Look at the light blue and light pink tracks again to feel it.

Grid area
The meaning of grid lines, cells, and tracks is to divide the container into the grid area you need. A range is a whole block that can contain multiple cells, so how to divide it? The area where the two horizontal grid lines cross the two vertical grid lines is the area. If the container is reasonably divided into multiple areas, then the purpose of the layout is also achieved. Regions can overlap, so it has z-index.

Today's concept section is introduced here. The knowledge related to grid layout programming will be introduced in detail later.
ps: Image excerpt from CSS Grid layout: what is grid layout

Companion article Deep understanding of layout artifacts flexbox



Grid, really layout artifacts. After the introduction of two modules of Flex layout and Grid layout, Css really had the concept of layout. The original table layout did not know that it was a god of ghosts, and then float to the sky, you might also use abosulte to achieve the layout of the page. In short, it is particularly awkward to implement. Always pay attention to it: Will it collapse when I write it, and will it affect the elements behind it? Why does Nima still collide. The author boldly calls these implementations layout tricks, and Flex and Grid are the real layouts. Flex is responsible for one-dimensional layout, and Grid is responsible for two-dimensional layout. Both layouts are very powerful, but one is more difficult than one, and the attributes are so many that you want to vomit blood. Today we will only focus on the concepts related to Grid layout.

Grid container
Where grid layout starts, the carrier of the grid module. From the outside, it seems to be a block or an inline-block block, and the inside of the container is one by one. Like the Flex layout, it also has container properties and project properties.

Gridlines
There are horizontal and vertical grid lines. The criss-cross lines cut the grid container into the smallest unit cells. The grid lines are numbered, starting with the number 1. There are 6 horizontal lines and 6 vertical lines. You can also name the line if you like, and a line can have multiple names.

Cell
The green background block in the Grid Cell diagram is the cell. The smallest unit of measurement for the grid layout is 25 cells.

Grid track
The middle part of two adjacent grid lines is a track. Why should we have the concept of a track? Because the width of the track needs to be set, if the width and height are set separately on the cells, it may become a waterfall flow complex. The degree rises in a swish. Look at the light blue and light pink tracks again to feel it.

Grid area
The meaning of grid lines, cells, and tracks is to divide the container into the grid area you need. A range is a whole block that can contain multiple cells, so how to divide it? The area where the two horizontal grid lines cross the two vertical grid lines is the area. If the container is reasonably divided into multiple areas, then the purpose of the layout is also achieved. Regions can overlap, so it has z-index.

The above is the GRID tutorial for CSS grid layout, I hope to help everyone.

related suggestion:

CSS Grid layout guide

Introduction to CSS Grid Layout Module_html / css_WEB-ITnose

Five minutes to teach you CSS Grid layout

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.