• 网格布局之grid


     1 <!DOCTYPE HTML>
     2 <!DOCTYPE html>
     3 <html>
     4 <head>
     5     <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
     6     <title>
     7         网格布局
     8     </title>
     9     <link rel="stylesheet"  href="网格布局.css">
    10 
    11 </head>
    12 <body>
    13 <div class="wrapper">
    14   <div class="one">One</div>
    15   <div class="two">Two</div>
    16   <div class="three">Three</div>
    17   <div class="four">four</div>
    18   <div class="five">Five</div>
    19   <div class="six">Six</div>
    20   <div class="seven">Seven</div>
    21   <div class="eight">Eight</div>
    22   <div class="nine">Nine</div>
    23 </div>
    24 </body>
    25 </html>
    .wrapper{
        display: grid;
      grid-template-columns: repeat(4,100px);
       /* grid-gap: 10px;*/
      grid-auto-rows: 100px;
    }
    
    
    .one{
      display: inline-block;
        width: 500px;
        height: 100px;
        background: red;
        color:black;
         grid-column: 1 / span 4;
         grid-row: 1 / 2;   
    }
    .two{
      display: inline-block;
        width: 100px;
        height: 200px;
        background: yellow;
        color:black;
         grid-column: 1 / 2;
         grid-row: 2 / 3;   
    }
    
    .three{
      display: inline-block;
        width: 100px;
        height: 100px;
        background: yellow;
        color:black;
         grid-column: 2 / 3;
         grid-row: 2 / 3;   
    }
    .four{
      display: inline-block;
        width: 100px;
        height: 100px;
        background: green;
        color:black;
         grid-column: 3 / 4;
         grid-row: 2 / 3;   
    }
    .five{
      display: inline-block;
        width: 100px;
        height: 100px;
        background: pink;
        color:black;
         grid-column: 4 / 5;
         grid-row: 2 / 3;   
    }
    .six{
      display: inline-block;
        width: 100px;
        height: 200px;
        background: lime;
        color:black;
         grid-column: 5 / 6;
         grid-row: 2 / 3;   
    }
    .seven{
      display: inline-block;
        width: 100px;
        height: 100px;
        background: blue;
        color:black;
         grid-column: 2 / 3;
         grid-row: 3 / 4;   
    }
    .eight{
      display: inline-block;
        width: 100px;
        height: 100px;
        background: purple;
        color:black;
         grid-column: 3 / 4;
         grid-row: 3 / 4;   
    }
    .nine{
      display: inline-block;
        width: 100px;
        height: 100px;
        background: seagreen;
        color:black;
         grid-column: 4 / 5;
         grid-row: 3 / 4;   
    }
  • 相关阅读:
    【leetcode】腾讯精选练习 50 题(更新中)
    将博客搬至CSDN
    【笔记】linux基础(更新中)
    【寒窑赋】写在百篇博客之后
    【笔记】Vim
    【笔记】Git(更新中)
    【笔记】Java基础教程学习(更新中)
    【面试题】Java核心技术三十六讲(更新中)
    【leetcode】shell和sql题目思路汇总(更新中)
    【笔记】MySQL基础及高级特性(更新中)
  • 原文地址:https://www.cnblogs.com/erxiaojiedeah/p/9800780.html
Copyright © 2020-2023  润新知