CSS3 Grid Layout & <track-size> & <line-name>

grid container

grid-template: <grid-template-rows> / <grid-template-columns> === grid-template-rows + grid-template-columns


.container {
display: grid;
/* grid-template: <grid-template-rows> / <grid-template-columns> */
/* grid-template: <grid-template-rows> / <grid-template-columns> */
} /* track-size */
.container {
display: grid;
grid-template-columns: 1fr 2fr 1fr;
grid-template-rows: 100px 50px 100px;
} /* line-name */ .container {
grid-template-columns: [first] 40px [line2] 50px [line3] auto [col4-start] 50px [five] 40px [end];
grid-template-rows: [row1-start] 25% [row1-end] 100px [third-line] auto [last-line];
}

bracket syntax for the line names

索引

/* 网格线 */

/* columns 正向 从左到右 */
[1] column item1 [2] column item2 [3] column item3 [4] column item4 [5] column item5 [6] /* columns 逆向 从右到左 */
[-6] column item1 [-5] column item2 [-4] column item3 [-3] column item4 [-2] column item5 [-1]
/* 网格线 */

/* rows 正向 从上到下 */
[1]
row item1
[2]
row item2
[3]
row item3
[4] /* columns 逆向 从下到上 */
[-4]
row item1
[-3]
row item2
[-2]
row item3
[-1]

name

a line can have more than one name

/* 网格线 */

/* columns 正向 从左到右 */
[first] column item1 [line2] column item2 [line3] column item3 [col4-start] column item4 [five] column item5 [end]
/* 网格线 */

/* rows 正向 从上到下 */
[row1-start]
row item1
[row1-end row2-start]
row item2
[third-line row2-end]
row item3
[last-line]
/* bracket name */
.container {
grid-template-columns: [first] 40px [line2] 50px [line3] auto [col4-start] 50px [five] 40px [end];
grid-template-rows: [row1-start] 25% [row1-end] 100px [third-line] auto [last-line];
} /* repeat */
.container {
grid-template-columns: repeat(3, 20px [col-start]);
} /* equivalent to */
.container {
grid-template-columns: 20px [col-start] 20px [col-start] 20px [col-start];
}

图解

自定义 line-name

默认的 line index

refs

https://css-tricks.com/snippets/css/complete-guide-grid/#

http://www.ruanyifeng.com/blog/2019/03/grid-layout-tutorial.html

自定义 line-name



xgqfrms 2012-2020

www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!


CSS3 Grid Layout & <track-size> & <line-name>的更多相关文章

  1. CSS3 GRID LAYOUT

    CSS3 GRID LAYOUT http://www.w3cplus.com/blog/tags/356.html 中国首个开源 HTML5 跨屏前端框架 http://amazeui.org/

  2. CSS3 & Grid Layout All In One

    CSS3 & Grid Layout All In One W3C https://www.w3.org/TR/css-grid-1/ Grid Layout is a new layout ...

  3. [转]使用CSS3 Grid布局实现内容优先

    使用CSS3 Grid布局实现内容优先  http://www.w3cplus.com/css3/css3-grid-layout-module.html 本文由大漠根据Rachel Andrew的& ...

  4. css grid layout in practice

    css grid layout in practice https://caniuse.com/#search=grid subgrid https://caniuse.com/#search=cal ...

  5. css-next & grid layout

    css-next & grid layout css3 demo https://alligator.io/ @media only screen and (max-width: 30em) ...

  6. iphone Dev 开发实例9:Create Grid Layout Using UICollectionView in iOS 6

    In this tutorial, we will build a simple app to display a collection of recipe photos in grid layout ...

  7. Unity3D 使用 UI 的 Grid Layout Group 组件。

    1.首先创建一个容器,用于存放列表项的内容. 这里使用 Panel 来做为容器. 这里要注意! “Grid Layout Group”是要增加在容器的游戏对象里. 同时,只有容器对象的子对象才有排列效 ...

  8. WPF笔记(2.4 Grid)——Layout

    原文:WPF笔记(2.4 Grid)--Layout 第一章已经简单介绍过这个容器,这一节详细介绍.Grid一般是用表格(Grid.Row 和Grid.Column )的,比StackPanel更细致 ...

  9. flexbox与grid layout的区别

    flexbox是一种针对一维的局部布局,以轴为核心的弹性布局. grid layout是二维的更加全面的网格布局,

随机推荐

  1. SpringIOC的注解应用

    SpringIOC的注解应用 ​ 在之前的项目中,我们都是通过xml文件进行bean或者某些属性的赋值,其实还有另外一种注解的方式,在企业开发中使用的很多,在bean上添加注解,可以快速的将bean注 ...

  2. 内联扩展 inline expansion An Inline Function is As Fast As a Macro 与宏的比较

    让编译器直接将完整的函数体插入到每一个调用该函数的地方,从而提高函数调用的运行速度. 优秀的JIT编译器会通过侦测运行信息,仅将需要频繁运行的瓶颈部分进行编译,从而大大削减编译所需的时间. 而且,利用 ...

  3. 在VMware15安装Ubuntu 16.04

    安装环境: VMware15 VMware15官网地址:https://my.vmware.com/cn/web/vmware/info/slug/desktop_end_user_computing ...

  4. Linux忽略大小写的查找技巧(转)

    1.vim 中的查找 Linux 下 vim搜索文件内容时加上 \c 参数可以忽略搜索字符的大小写. 比如用vim 搜索文件中的 China 时 可用 :/china\c 2. find 查找 Lin ...

  5. 【疑】checkpoint防火墙双链路负载均衡无法配置权重问题

    现状: 按照上一篇checkpoint疑难中描述,已完成双机+双链路冗余配置 故障现象: 外网出口为200M电信+200M联通,CP上负载权重设置如下 但是在实际使用中发现电信出口流量远大于联通. 调 ...

  6. Java并发包源码学习系列:阻塞队列实现之LinkedTransferQueue源码解析

    目录 LinkedTransferQueue概述 TransferQueue 类图结构及重要字段 Node节点 前置:xfer方法的定义 队列操作三大类 插入元素put.add.offer 获取元素t ...

  7. Trap HDU - 6569 二分

    题意: 给你n个边长ai,你需要挑出来4个边使得它们可以构成等腰梯形.问你能构成多少种不同的等腰梯形 题解: 我们首先处理一下边长为x的且这个边长出现大于等于2次的边,因为等腰梯形需要两条相等的边 然 ...

  8. Codeforces Round #649 (Div. 2) C. Ehab and Prefix MEXs (构造,贪心)

    题意:有长度为\(n\)的数组\(a\),要求构造一个相同长度的数组\(b\),使得\({b_{1},b_{2},....b_{i}}\)集合中没有出现过的最小的数是\(a_{i}\). 题解:完全可 ...

  9. 洛谷 P1135 奇怪的电梯 (DFS)

    题意:有一\(n\)层高的大楼,每层楼都只能在合法情况下上\(x\)层或者下\(x\)层,问你是否能从\(a\)层楼坐电梯到\(b\)层楼,输出最小步数. 题解:直接dfs搜,\(flo\)表示层数, ...

  10. Cell 动态行高文字显示不全问题探索

    目录 问题概述 一.新建工程 二.尝试复现问题 尝试解决 修改contentLblBtmCon优先级为High(750) 修改contentLblBtmCon优先级为Low(250) 小结 其他解决思 ...