Grid grid layout

Source: Internet
Author: User
Grid

With grid layout, you can make your page layout look like a grid. You can place each component in the desired position.

HTML:

<div id="container">  <div></div>  <div></div>  <div></div>  <div></div>  <div></div>  <div></div>  <div></div>  <div></div></div>css

 

CSS:

#container {  display: grid;  grid: repeat(2, 60px) / auto-flow 80px;}#container > div {  background-color: #8ca0ff;  width: 50px;  height: 50px;}

Effect:

 

Grid-gap

Define the distance between elements

  Grid-column-gap/GRID-row-gap

Grid-column-gap: defines the distance between columns and columns

Grid-row-gap: defines the distance between rows.

Grid-column-Start/end and gird-row-Start/end

Grid-column-start:Specifies the gridline in which the start baseline of the column to be modified is located.

Grid-column-end:Specifies the gridline in which the end baseline of an element is changed. This increases the space occupied by an element.

Grid-row-Start/end:The above functions are the same, but the line is changed.

Grid-template-columns/rows

Grid-template-columns: Set the width of each column element

Grid-template-rows: Set the height of each element.

 

 

 

 

 

 

Grid grid layout

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.