寒假学习记录11:grid布局

1.

display:grid

2.

grid-template-columns: 100px 100px 100px  //指定每列的宽度
grid-template-rows: 100px 100px 100px    //指定每行的宽度

3.

column-gap: 24px    //列间距
row-gap: 24px    //行间距
gap: 24px    //都设置

4.grid-template-areas用法

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    .container{
        width: 100px;
        display: grid;
        grid-template-areas: 
            "header header header"
            "sidebar content content"
            "footer footer footer";
        gap: 10px;
    }
    header{
        width: 1fr; height: 30px;
        grid-area: header;
        background-color: red;
    }
    main{
        width: 60px; height: 50px;
        grid-area: content;
        background-color: aqua;
    }
    aside{
        width: 40px; height: 50px;
        grid-area: sidebar;
        background-color: green;
    }
    footer{
        width: 1fr; height: 30px;
        grid-area: footer;
        background-color: blue;
    }
</style>
<body>
    <div class="container">
        <header></header>
        <aside></aside>
        <main></main>
        <footer></footer>
    </div>
</body>
</html>

效果

        

5.

        align和justify和flex一样

6.

        grid特有的浮动单位:fr

        长度为   当前fr / 总fr

相关推荐

  1. 寒假学习记录15:Node(网络)

    2024-02-14 07:02:01       27 阅读
  2. 寒假学习记录16:Express框架(Node)

    2024-02-14 07:02:01       33 阅读
  3. 2024.1.28 寒假训练记录11

    2024-02-14 07:02:01       42 阅读
  4. 2024.2.1 寒假训练记录15

    2024-02-14 07:02:01       35 阅读
  5. 2024.2.15 寒假训练记录(24)

    2024-02-14 07:02:01       29 阅读
  6. 网格布局 Grid

    2024-02-14 07:02:01       42 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-02-14 07:02:01       16 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-02-14 07:02:01       16 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-02-14 07:02:01       15 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-02-14 07:02:01       18 阅读

热门阅读

  1. ES实战-聚集

    2024-02-14 07:02:01       29 阅读
  2. Socket.D 开源输传协议 v2.4.0 发布

    2024-02-14 07:02:01       37 阅读
  3. Django学习全纪录:Django开发环境的搭建

    2024-02-14 07:02:01       34 阅读
  4. django的基本使用-ORM(二)

    2024-02-14 07:02:01       27 阅读
  5. 【笔记】Helm-5 Chart模板指南-12 .helmignore文件

    2024-02-14 07:02:01       36 阅读
  6. 2/12作业

    2024-02-14 07:02:01       26 阅读
  7. iOS swift XHToast.showCenterWithText不显示

    2024-02-14 07:02:01       36 阅读
  8. 1.Swift简介和发展

    2024-02-14 07:02:01       24 阅读
  9. 从Unity到Three.js(计时器、Transform)

    2024-02-14 07:02:01       27 阅读
  10. Atcoder ABC338 A - Capitalized?

    2024-02-14 07:02:01       30 阅读
  11. c++中的&

    2024-02-14 07:02:01       25 阅读
  12. 文档类图像的智能识别,文档分类自定义分类器

    2024-02-14 07:02:01       28 阅读