当前位置:网站首页>Grid网格布局常考面试题
Grid网格布局常考面试题
2022-07-19 12:25:00 【MOAN.】
Grid网格布局的好处不亚于Flex,可以快速将布局有规格的划分为想要的模块,和flex的开启方法一样,一句 display:grid
便可启动
这里直接送上讲解传送门,可以去看阮一峰老师的博客,不仅Flex弹性布局写的很好,Grid网格布局也很Nice
CSS Grid 网格布局教程 - 阮一峰的网络日志 (ruanyifeng.com)
今天来和大家分享几道关于Grid常考的高频面试题
1 Grid如何实现类似 flex:row-reverse的效果
通过grid-auto-flow和direction
grid-auto-flow:row|column|dense
该属性指定采用 grid 布局的容器内部的元素如何排序
direction:rt|Irt
指定文本 表列的水平方向
2.盒子三等分
1.Grid
.grid-container {
display: grid;
grid-template-columns: 1fr 1fr 1fr(fr=fraction);
gap: 1rem;
}
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-MthSqgDx-1657715104306)(https://p9-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/8612c42a8a024db884b28f9dcf36197a~tplv-k3u1fbpfcp-watermark.image?)]
根据最新标准,上面三个属性名的grid-
前缀已经删除,grid-column-gap
和grid-row-gap
写成column-gap
和row-gap
,grid-gap
写成gap
。
2.flex
.flex-container {
display: flex;
flex-wrap: wrap;
// gap: 1rem;
.item {
flex: 0 0 calc(100% / 3);
}
}
3.Grid的优势
Flex 布局是轴线布局,只能指定"项目"针对轴线的位置,可以看作是一维布局。
Grid 布局则是将容器划分成"行"和"列",产生单元格,然后指定"项目所在"的单元格,可以看作是二维布局。 Grid 布局远比 Flex 布局强大
参考来自山月的博客,真的是面试好帮手
【Q506】Grid 布局如何实现类似 flex: row-reverse | css高频面试题 | 大厂面试题每日一题 (shanyue.tech)
转载:欢迎转载,但未经作者同意,必须保留此段声明;
有问题可以在评论区踢我
边栏推荐
猜你喜欢
Recommend a development tool that supports data + code generation! yyds
组合数学学习笔记(未完待续
Provincial selected and specially trained [haoi2009] caterpillar
省选专练之【PKUSC2018】主斗地
图像标注开源小工具-labelImg
智源承认论文抄袭,相关责任人已离职!
[Golang数据库专题5]Golang语言操作Redis进行增删改查
分布式链路日志minbox-logging使用文档
[question brushing diary] longest palindrome substring
IDEA中如何安装插件和宝贝插件的推荐
随机推荐
25、继承与派生
[special topic of golang database 5] golang language operation redis for addition, deletion, modification and query
Machine learning Basics (1) photo video display, mouse, control operation
[mindspore] [read graph data] cannot read graph data in mindrecord format
分布式链路日志minbox-logging使用文档
mos管的输入输出特性曲线及gm/id仿真曲线(cadence IC617)
(0711-0717)本周开源软件安全大事记
分析脚手架
mindspore 8卡V100训练到101个epoch的时候报读取数据超时的错误
全球1000+研究员在Twitter直播训练超大模型??
The resources in the target folder cannot be loaded by the program
【Mindspore】【读取图数据】无法读取Mindrecord格式图数据
Function recursion exercises (easy version)
基于Xlinx的时序分析与约束(1)----什么是时序分析?什么是时序约束?什么又是时序收敛?
was expecting double-quote to start field name错误
Meiker Studio - Huawei 14 day Hongmeng equipment development practical notes 5
pytorch训练模型时dataloader报错“default_collate: batch must contain tensors, numpy arrays, numbers, dicts ”
deeplabv1和v2
Who else can't answer the three MQ interview questions that an interviewer must ask??
最基本的排序