显式网格布局包含:行、列

grid-template-columns

page {
color: #fff;
} .grid {
padding:1%;
display: grid;
grid-gap: 1px;
/* grid-template-rows: 50px 100px 50px; */
grid-template-columns: 50px 150px 100px;
} .grid-row {
text-align: center;
background-color: #d94a6a;
}

grid-template-rows

page {
color: #fff;
} .grid {
padding:1%;
display: grid;
grid-gap: 1px;
grid-template-rows: 50px 100px 50px;
} .grid-row {
text-align: center;
background-color: #d94a6a;
}

以上行、列网格可以搭配使用! 如果未定义grid-template-columnsgrid-template-rows,则宽高根据自身内容.

也可以采用等份计算单位"fr" (一旦采用fr,就会自动计算填充宽度)

page {
color: #fff;
} .grid {
padding:1%;
display: grid;
grid-gap: 1px;
/* grid-template-rows: 50px 100px 50px; */
/* grid-template-columns: 50px 150px 100px; */
grid-template-columns: 1fr 1fr 2fr;
} .grid-row {
text-align: center;
background-color: #d94a6a;
}

计算单位也可以不同,它会自动进行混合运算

网格宽度:默认100%

假设iphone6 => 375px,

1fr = (网格宽度 - 3rem - 网格宽度 * 25%) / 3
<view class="grid">
<view class='grid-row'>1</view>
<view class='grid-row'>2</view>
<view class='grid-row'>3</view>
<view class='grid-row'>4</view>
</view>
page {
color: #fff;
font-size: 16px;
} .grid {
/* padding: 1%; */
display: grid;
grid-gap: 1px;
grid-template-columns: 3rem 25% 1fr 2fr;
} .grid-row {
text-align: center;
background-color: #d94a6a;
}

grid - 显式网格的更多相关文章

  1. grid - 隐式网格

    当网格项目确认在显式网格之外时就会创建隐性网格,当没有足够的空间或者显式的网格轨道来设置网格项目,此时网格项目就会自动创建隐式网格. 隐式网格可以定义:grid-auto-rows.grid-auto ...

  2. CSS3 网格布局(grid layout)基础知识 - 隐式网格自己主动布局(grid-auto-rows/grid-auto-columns/grid-auto-flow)

    网格模板(grid-template)属性及其普通写法(longhands)定义了一个固定数量的轨道.构成显式网格. 当网格项目定位在这些界限之外.网格容器通过添加隐式网格线生成隐式网格轨道. 这些隐 ...

  3. grid - 隐式地命名网格区域名称

    通常可以将网格线命名成任何你想命名的名称,如果网格线名称添加-start和-end的后缀,其实也隐式的创建一个网格区域,可以用来设置网格项目的位置. 在这个示例中,行和列都具有inner-start和 ...

  4. CoreAnimation4-隐式动画和显式动画

    事务 Core Animation基于一个假设,说屏幕上的任何东西都可以(或者可能)做动画.动画并不需要你在Core Animation中手动打开,相反需要明确地关闭,否则他会一直存在. 当你改变CA ...

  5. iOS 动画基础-显式动画

    摘要 显式动画 属性动画 CABasicAnimation *animation = [CABasicAnimation animation];         [self updateHandsAn ...

  6. 浅析SQL查询语句未显式指定排序方式,无法保证同样的查询每次排序结果都一致的原因

    本文出处:http://www.cnblogs.com/wy123/p/6189100.html 标题有点拗口,来源于一个开发人员遇到的实际问题 先抛出问题:一个查询没有明确指定排序方式,那么,第二次 ...

  7. C++中的显式类型转化

    类型转化也许大家并不陌生,int i; float j; j = (float)i; i = (int)j; 像这样的显式转化其实很常见,强制类型转换可能会丢失部分数据,所以如果不加(int)做强制转 ...

  8. 《Entity Framework 6 Recipes》中文翻译系列 (28) ------ 第五章 加载实体和导航属性之测试实体是否加载与显式加载关联实体

    翻译的初衷以及为什么选择<Entity Framework 6 Recipes>来学习,请看本系列开篇 5-11  测试实体引用或实体集合是否加载 问题 你想测试关联实体或实体集合是否已经 ...

  9. 当 IDENTITY_INSERT 设置为 OFF 时,不能向表 'OrderList' 中的标识列插入显式值

    问题描述:在SQL SERVER 2008中,向数据表中字段插入数据时,会报错,错误如下: 当 IDENTITY_INSERT 设置为 OFF 时,不能向表 'OrderList' 中的标识列插入显式 ...

随机推荐

  1. Django整合Keras报错:ValueError: Tensor Tensor("Placeholder:0", shape=(3, 3, 1, 32), dtype=float32) is not an element of this graph.解决方法

    本人在写Django RESful API时,碰到一个难题,老出现,整合Keras,报如下错误:很纠结,探索找资料近一个星期,皇天不负有心人,解决了 Internal Server Error: /p ...

  2. CSS - !important声明强制优先

    !important声明强制优先 CSS优先级中还有一个最无敌的声明,就是!important. 在CSS样式表中,带有!important声明的样式优先使用,它的优先级会超越任何地方.任何方式的样式 ...

  3. H 模拟水题

    n个人 小明编号为m 从编号为a的人开始数 起始数字为b 遇到素数duang 并反相 求小明应该说什么 Sample Input 310 2 //n m3 4 //a b3 32 64 13 8 Sa ...

  4. tomcat常用的配置

    这里我们使用tomcat版本:apache-tomcat-7.0.77-windows-x64.zip 为例:下载链接地址为:https://archive.apache.org/dist/tomca ...

  5. python爬取京东价格

    昨天准备爬取一个京东商品的价格,正则写好了一直是空的 后来我去页面里面看了下,价格标签里果然是空的 百度了下,大家都说是js来控制显示价格的 于是去抓包试试,找到了一条mgets的请求 中间很多参数不 ...

  6. Python5 - 字符编码

    Python 字符编码 参考详细文章:   py编码终极版 http://www.diveintopython3.net/strings.html 1.在python2默认编码是ASCII, pyth ...

  7. linux shell cut 命令

    cut命令 cut命令用于从文件或者标准输入中读取内容并截取每一行的特定部分并送到标准输出. 截取的方式有三种:一是按照字符位置,二是按照字节位置,三是使用一个分隔符将一行分割成多个field,并提取 ...

  8. Unity报错 : BCE0004: Ambiguous reference 'preview': CameraMotionBlurEditor.preview, UnityEditor.Editor.preview.

    建立项目版本为Unity4.6,改为5.3.4版本,运行项目报如下错误: “BCE0004: Ambiguous reference 'preview': CameraMotionBlurEditor ...

  9. hql查询后释放内存

    Session session=getSession(); //进行session查询,取得前16个数据 Query q=session.createQuery(hql).setFirstResult ...

  10. loj#2129. 「NOI2015」程序自动分析

    题目链接 loj#2129. 「NOI2015」程序自动分析 题解 额... 考你会不会离散化优化常数 代码 #include<queue> #include<cstdio> ...