栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

网格区域在CSS网格中的布局不正确

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

网格区域在CSS网格中的布局不正确

使用该

grid-template-areas
属性时,字符串值必须具有相同的列数。

.grid {  display: grid;  grid-template-columns: 1fr 1fr;  grid-template-rows: 1fr 1fr;  grid-template-areas: "logo faq" "about-us about-us";}.logo {  background-color: blue;  grid-area: logo;}.faq {  background-color: red;  grid-area: faq;}.aboutUs {  background-color: cyan;  grid-area: about-us;}<div >  <div >    LOGO  </div>  <div >    FAq  </div>  <div >    about-us  </div></div>

您可以使用句点或句点的不间断行来表示一个空单元格(规范参考)。

.grid {  display: grid;  grid-template-columns: 1fr 1fr;  grid-template-rows: 1fr 1fr;  grid-template-areas: "logo faq" " ... about-us";}.logo {  background-color: blue;  grid-area: logo;}.faq {  background-color: red;  grid-area: faq;}.aboutUs {  background-color: cyan;  grid-area: about-us;}<div >  <div >    LOGO  </div>  <div >    FAq  </div>  <div >    about-us  </div></div>

从网格规范:

[7.3。 命名区域:

the grid-template-areas
属性]

所有字符串的列数必须相同,否则声明无效。

如果命名的网格区域跨越多个网格单元,但是这些单元不形成单个填充矩形,则声明无效。

在此模块的将来版本中,可能会允许非矩形或不连续区域。



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/670564.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号