Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does HTML create multiple grid cells in a grid layout

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

本文小编为大家详细介绍"HTML怎么在网格布局中创建多个网格的单元格",内容详细,步骤清晰,细节处理妥当,希望这篇"HTML怎么在网格布局中创建多个网格的单元格"文章能帮助大家解决疑惑,下面跟着小编的思路慢慢深入,一起来学习新知识吧。

说明:

上面的橙色单元格是grid-column:1/6;grid-row:1/2;

左边的蓝色单元格grid-column:1/3;grid-row:2/4;

正确的绿色单元格是grid-column:3/6;grid-row:2/3;

左下方的灰色单元格是grid-column:1/3;grid-row:4/5;

右下方的黄色单元格是grid-column:3/6;grid-row:3/5;

下面的白色单元格是

grid-column:1/2;grid-row:5/6;

grid-column:2/3;grid-row:5/6;

grid-column:3/4;grid-row:5/6;

grid-column:4/5;grid-row:5/6;

grid-column:5/6;grid-row:5/6;

下面将上述布局写入网格单元格的类中。

代码如下

编写以下HTML,CSS。

SimpleGrid.html

内容1

内容2

内容3

内容4

内容5

内容6

内容7

内容8

内容9

内容10

SimpleGrid.css

.Container{

display:grid;

grid-template-columns:160px160px160px160px160px;

grid-template-rows:120px120px120px120px120px;

border:solid#ff6a001px;

}

.GridItem1{

grid-column:1/6;

grid-row:1/2;

background-color:#ff9c9c;

}

.GridItem2{

grid-column:1/3;

grid-row:2/4;

background-color:#ffcb70;

}

.GridItem3{

grid-column:1/3;

grid-row:4/5;

background-color:#7ee68d;

}

.GridItem4{

grid-column:3/6;

grid-row:2/3;

background-color:#7ee6e2;

}

.GridItem5{

grid-column:3/6;

grid-row:3/5;

background-color:#95a7f5;

}

.GridItem6{

grid-column:1/2;

grid-row:5/6;

background-color:#d095f5;

}

.GridItem7{

grid-column:2/3;

grid-row:5/6;

background-color:#e1bbfa;

}

.GridItem8{

grid-column:3/4;

grid-row:5/6;

background-color:#d2b1e4;

}

.GridItem9{

grid-column:4/5;

grid-row:5/6;

background-color:#dcd2e1;

}

.GridItem10{

grid-column:5/6;

grid-row:5/6;

background-color:#eee8f1;

}

读到这里,这篇"HTML怎么在网格布局中创建多个网格的单元格"文章已经介绍完毕,想要掌握这篇文章的知识点还需要大家自己动手实践使用过才能领会,如果想了解更多相关内容的文章,欢迎关注行业资讯频道。

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report