当前位置:网站首页>Introduction to Grid Layout
Introduction to Grid Layout
2022-08-02 06:12:00 【m0_67401228】
1. What is Grid layout
Grid
layout is grid layout, which is a new css
model. Generally, a page is divided into several main areas, and the size of these areas is defined., position and hierarchy, is currently the only css
two-dimensional layout.
The difference between 2, and flex
layout
The Grid
layout is substantially different from the flex
layout. flex
is a one-dimensional layout and can only handle one dimension.Layout, row or column.However, the Grid
layout is a two-dimensional layout, dividing the container into "rows" and "columns", resulting in grids one by one, and grid elements can be placed in positions related to rows and columns, so as to achieve the purpose of layout.
flex
Layout example:
Grid
Layout example:
3, Grid
concept of layout
First, let's look at a small example to demonstrate some basic concepts
OneTwoThreeFourFiveSix.wrapper{margin: 60px;/* declare a container */display: grid;/* Declare the width of the column, the number 3 is repeated 3 times, that is, there are 3 columns with a width of 200px*/grid-template-columns: repeat(3,200px);/* declare line and column spacing */grid-gap: 20px;/* Represent the height of the two lines respectively */grid-template-rows: 100px 200px;}.item{text-align: center;font-size: 200%;color: #fff;}.one{background-color:#b8e8e0 ;}.two{background-color: #8CC7B5;}.three{background-color:#efe3bf ;}.four{background-color: #BEE7E9;}.five{background-color: #E6CEAC;}.six{background-color: #ECAD9E;}Run result:
![[External link image transfer failed, the origin site may have an anti-leech mechanism, it is recommended to save the imageDirect upload(img-6Kmdz0qf-1650274526452)(image-20220418172435782.png)]](/img/00/a730a2eb0bc6761da9bcb25c5bba7d.png)
Containers and Items
We create a grid by declaring display:grid
or display:inline-grid
on the elementContainer, all immediate children of this element will become grid items.
Grid Track
grid-template-columns
and grid-template-rows
properties to define the rows and columns in the grid
- Grid cells
A grid unit is the smallest unit in a grid element, One
, Two
, Three
, Four
…are all grid cells one by one
Gridlines
The lines that divide the grid are gridlines.It should be noted that when we define the grid, we define the grid track.Grid automatically creates numbered gridlines to position each element, m columns with m + 1 vertical gridlines, and n rows with n + 1 horizontal gridlines.Generally speaking, from left to right, from top to bottom, 1, 2, 3 are numbered and sorted, and from right to left, from bottom to top, they are numbered in the order of -1, -2, -3...
![[External link image transfer failed, the origin site may have anti-leech mechanism, it is recommended to save the imageDirect upload(img-iDntqg9z-1650274526453)(image-20220418173153836.png)]](/img/23/dbbec0bf71e5d1e8ad5c524963bdf0.png)
Let me introduce myself first. The editor graduated from Jiaotong University in 2013. I worked in a small company and went to big factories such as Huawei and OPPO. I joined Ali in 2018, until now.I know that most junior and intermediate java engineers want to upgrade their skills, they often need to explore their own growth or sign up to study, but for training institutions, the tuition fee is nearly 10,000 yuan, which is really stressful.Self-learning that is not systematic is very inefficient and lengthy, and it is easy to hit the ceiling and the technology stops.Therefore, I collected a "full set of learning materials for java development" for everyone. The original intention is also very simple. I hope to help friends who want to learn by themselves but don't know where to start, and at the same time reduce everyone's burden.Add the business card below to get a full set of learning materials
边栏推荐
- Does Conway's Law Matter for System Architecture?
- MySQL 字符串拼接 - 多种字符串拼接实战案例
- 2022年7月学习计划完成情况
- ApiPost is really fragrant and powerful, it's time to throw away Postman and Swagger
- el-input 只能输入整数(包括正数、负数、0)或者只能输入整数(包括正数、负数、0)和小数
- 软件测试常见的问题
- 21天学习挑战赛安排
- ORA-04044:此处不允许过程、函数、程序包或类型,系统分析与解决
- Android Studio 实现登录注册-源代码 (连接MySql数据库)
- Navicat报错:1045 -拒绝访问用户[email protected](使用passwordYES)
猜你喜欢
ApiPost is really fragrant and powerful, it's time to throw away Postman and Swagger
What do interview test engineers usually ask?The test supervisor tells you
2022年100道最新软件测试面试题,常见面试题及答案汇总
[PSQL] 窗口函数、GROUPING运算符
本周大新闻|苹果MR已进行Pre-EVT测试,Quest 2涨价100美元
Mycat2.0搭建教程
简道云-灵活易用的应用搭建平台
Android studio connects to MySQL and completes simple login and registration functions
c语言:查漏补缺(三)
MySQL 8.0.28 version installation and configuration method graphic tutorial
随机推荐
CAN光端机解决泰和安TX3016C消防主机长距离联网问题 实现CAN与光纤之间的双向数据智能转换
力扣 2127. 参加会议的最多员工数 拓扑剪枝与2360补充
MYSQL 唯一约束
MySQL 8.0.29 解压版安装教程(亲测有效)
Redis常见题型
物联网通信协议全解析
H5如何实现唤起APP
What do interview test engineers usually ask?The test supervisor tells you
2022年7月学习计划完成情况
mysql 存储过程详解
Google Chrome(谷歌浏览器)安装使用
Detailed explanation of mysql stored procedure
Navicat如何连接MySQL
[QNX Hypervisor 2.2用户手册]9.18 unsupported
MySQL夺命10问,你能坚持到第几问?
系统(层次)聚类
MySQL(7)
2022年100道最新软件测试面试题,常见面试题及答案汇总
编译失败:HBuilderX 安装目录不能包括 ( 等特殊字符 (HBuilderX,uni-app报错)
Does Conway's Law Matter for System Architecture?