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. LVS负载均衡理论以及算法概要

    一. LVS简介 LVS是Linux Virtual Server的简称,也就是Linux虚拟服务器, 由章文嵩博士发起的自由软件项目,它的官方站点是www.linuxvirtualserver.or ...

  2. Avoid catching exceptions inside atomic! You may need to manually revert model state when rolling back a transaction. 避免异常程序不抛错误 回滚 导致 自增id不连续。

    https://docs.djangoproject.com/en/3.0/topics/db/transactions/ You may need to manually revert model ...

  3. (Oracle)数据库用户的密码过期时间如何修改为永不过期

    Oracle的密码过期规则是用Profile来管理的,系统默认只有一个Profile(DEFAULT),该profile的密码过期规则为180天.那么如何修改Oracle数据库用户的密码过期时间为永不 ...

  4. LOJ10081

    USACO 201 Jan. Gold Farmer John 正在一个新的销售区域对他的牛奶销售方案进行调查.他想把牛奶送到 T 个城镇 ,编号为 1 到 T.这些城镇之间通过 R 条道路(编号为 ...

  5. JS从后台获取数据,前台动态添加tr标签中的td标签

    功能描述: 要求从后台查询该省份的所有城市,然后动态的再前台固定的tr标签中添加相应的td标签来展示城市基本信息: 文章目录 #一.前台jsp及js源码 jsp:在固定的tr标签中添加一个id,通过j ...

  6. 开发基础 (变量、数据类型、格式化输出、运算符、流程控制、while循环)

    一.变量 name = "SmallNine" 等号前面是变量名(标识符),等号后面是变量值 变量的主要作用:就是把程序运算的中间结果临时存到内存里,已备后面的代码继续调用. 变量 ...

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

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

  8. 【Azure 事件中心】在微软云中国区 (Mooncake) 上实验以Apache Kafka协议方式发送/接受Event Hubs消息 (Java版)

    问题描述 事件中心提供 Kafka 终结点,现有的基于 Kafka 的应用程序可将该终结点用作运行你自己的 Kafka 群集的替代方案. 事件中心可与许多现有 Kafka 应用程序配合使用.在Azur ...

  9. Jenkins(3)拉取git仓库代码,执行python自动化脚本

    前言 python自动化的脚本开发完成后需提交到git代码仓库,接下来就是用Jenkins拉取代码去构建自动化代码了 新建项目 打开Jenkins新建一个自由风格的项目 源码管理 Repository ...

  10. unix环境高级编程第四章笔记

    文件和目录 start fstart lstart函数 一旦给出pathname, start函数就返回了与此命名文件有关的信息结构 #include <sys/start> int st ...