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. flume到底会丢数据吗?其可靠性如何?——轻松搞懂Flume事务机制

    先给出答案: 需要结合具体使用的source.channel和sink来分析,具体结果可看本文最后一节. Flume事务   一提到事务,我们首先就想到的是MySQL中的事务,事务就是将一批操作做成原 ...

  2. map 传递给函数的代价

    https://github.com/unknwon/the-way-to-go_ZH_CN/blob/master/eBook/08.1.md map 传递给函数的代价很小:在 32 位机器上占 4 ...

  3. 策略模式 VS 状态模式

    策略模式 VS 状态模式 策略模式 VS 状态模式 | 菜鸟教程 https://www.runoob.com/w3cnote/state-vs-strategy.html

  4. .Vue-router跳转和location.href有什么区别

    使用location.href='/url'来跳转,简单方便,但是刷新了页面:使用history.pushState('/url'),无刷新页面,静态跳转:引进router,然后使用router.pu ...

  5. scala/java等其他语言从CSV文件中读取数据,使用逗号','分割可能会出现的问题

    众所周知,csv文件默认以逗号","分割数据,那么在scala命令行里查询的数据: 可以看见,字段里就包含了逗号",",那接下来切割的时候,这本应该作为一个整体 ...

  6. 「THP3考前信心赛」解题报告

    目录 写在前面&总结: T1 T2 T3 T4 写在前面&总结: \(LuckyBlock\) 良心出题人!暴力分给了 \(120pts\) \(T1\) 貌似是个结论题,最后知道怎么 ...

  7. Spring MVC参数处理

    使用Servlet API作为参数 HttpServletRequest HttpServletResponse HttpSession 使用流作为参数 总结 Spring MVC通过分析处理处理方法 ...

  8. vagrant虚拟化之多网卡网络配置

    vagrant虚拟化之多网卡网络配置 一.network改为public 二.查看本地主机网络的ip地址范围(最佳解决方案) 三.vagrant优秀博文 vagrant虚拟化之多网卡网络配置,通过am ...

  9. vmware安装linux系统,自动建立没选项

    虚拟机安装CentOS自己跳过分区,直接就到最后的软件包安装了 建完系统后不用power on,建完后在edit一下系统参数,应该会看见两个cd, 有一个是vmware自己加的,把那个删除后在开机就可 ...

  10. 设计模式(二)——Java简单工厂模式

    简单工厂模式 案例: 披萨的项目(要便于披萨种类的扩展,要便于维护) 1)披萨的种类很多(比如 GreekPizz.CheesePizz 等) 2)披萨的制作有 prepare,bake, cut, ...