码迷,mamicode.com
首页 > Web开发 > 详细

[CSS] Specify grid columns, rows, and areas at once with the grid-template shorthand

时间:2017-04-05 01:33:34      阅读:205      评论:0      收藏:0      [点我收藏+]

标签:using   play   class   named   isp   main   end   template   ecif   

We can specify grid columns, rows, and areas in one property using the grid-template shorthand.

 

        .container {
            display: grid;
            height: 100vh;
            grid-gap: 10px;
            grid-template-areas:
                "nav-1 nav-2 nav-3"
                "main main nav-3";
            grid-template-columns: 2fr auto 1fr;
            grid-template-rows:
                [nav-start] 1fr
                [nav-end main-start] 5fr
                [main-end];
        }

 

The same as:

        .container {
            display: grid;
            height: 100vh;
            grid-gap: 10px;
            grid-template:
                [nav-start] "nav-1 nav-2 nav-3" 1fr [nav-end]
                [main-start] "main main nav-3" 5fr [main-end]
                / 2fr auto 1fr;
            /*
                [named grid row line start] "area1 area2 ..." 1fr [named-grid-line end]
            */
        }

 

 

[CSS] Specify grid columns, rows, and areas at once with the grid-template shorthand

标签:using   play   class   named   isp   main   end   template   ecif   

原文地址:http://www.cnblogs.com/Answer1215/p/6666805.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!