Get the App
SLTechnology News&Howtos  ›  Development  › 

How to implement Grid layout in css

Shulou Source: shulou.com Published: 2022-06-01 11:22:59 09月19日 Update

This article mainly introduces how to achieve the grid layout of css, the article introduces in great detail, has a certain reference value, interested friends must read it!

First, use float:

The code is as follows:

Section

{

Border: solid 1px

}

Section section

{

Float: left

Margin-left: 10px

Margin-top: 10px

Text-align: center

Width: 200px

Border-radius: 20px

Height: 200px

}

.parent

{

Height: 440px

Width: 660px

}

.parent section:first-child

{

Height: 410px

}

A

B

C

D

E

Second, use display:flex (this css3 attribute is only supported by Google and Firefox)

The code is as follows:

Section

{

Border: solid 1px

}

Section section

{

Margin-left: 10px

Margin-top: 10px

Text-align: center

Width: 200px

Border-radius: 20px

Height: 200px

}

.parent

{

Display: flex

Flex-direction: column

Flex-wrap: wrap

Height: 440px

Width: 660px

}

.parent section:first-child

{

Height: 410px

}

A

B

C

D

E

The above is all the content of the article "how to achieve grid layout in css". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Tags: Layout grid code content articles values interests guys buddies attributes more Firefox knowledge industry information information channels channels references help support Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno MariaDB Docker vpn MySQL