Grid-layout基础用法 grid就是二维的flex,能理解吧 如果设置了grid布局,容器内float、table-cell等将失效 123// 九宫格布局display: grid/inline-grid;grid-template-columns/rows: repeat(3/autofill, 100px); 均分用autofill自动填充 1fr、2fr代表是前面的一倍、两倍 取值范围minmax(100px, 1fr) justify-items、align-items、place-items跟flex一样 或者 justify-self、align-self、place-self跟前面效果一样 justify-content、align-content、place-content跟flex一样- Grid-layout高级用法 指定每跟网络线名字 12grid-template-columns: [c1] 10px [c2] 10px [c3] 10px [c4] autogrid-template-rows: [r1] 10px [r2] 10px [r3] 10px [r4] auto 妈妈我要变成bootstrap可以嘛?当然可以 123grid-template-columns: repeat(12, 1fr) orgrid-template-rows: repeat(12, 1fr) 设置行列间隔 1234grid-row-gap: 10px;grid-columns-gap: 20px; orgrid-gap: 10px 20px; 指定一个区域由单元格组成 123grid-template-areas: 'a b c' 'd e f' 'g h i' 先行后列?or 先列后行? 1grid-auto-flow: rows dense; //dense 尽量填充满空格 Author: inpm.cy@gmail.com Link: https://inpm.top/2019/04/04/Grid-layout/ Copyright: All articles in this blog are licensed under inpm unless stating additionally.< PreviousPost写给我还在大一的妹妹NextPost >关于我看到的前端未来
Grid-layout基础用法 grid就是二维的flex,能理解吧 如果设置了grid布局,容器内float、table-cell等将失效 123// 九宫格布局display: grid/inline-grid;grid-template-columns/rows: repeat(3/autofill, 100px); 均分用autofill自动填充 1fr、2fr代表是前面的一倍、两倍 取值范围minmax(100px, 1fr) justify-items、align-items、place-items跟flex一样 或者 justify-self、align-self、place-self跟前面效果一样 justify-content、align-content、place-content跟flex一样- Grid-layout高级用法 指定每跟网络线名字 12grid-template-columns: [c1] 10px [c2] 10px [c3] 10px [c4] autogrid-template-rows: [r1] 10px [r2] 10px [r3] 10px [r4] auto 妈妈我要变成bootstrap可以嘛?当然可以 123grid-template-columns: repeat(12, 1fr) orgrid-template-rows: repeat(12, 1fr) 设置行列间隔 1234grid-row-gap: 10px;grid-columns-gap: 20px; orgrid-gap: 10px 20px; 指定一个区域由单元格组成 123grid-template-areas: 'a b c' 'd e f' 'g h i' 先行后列?or 先列后行? 1grid-auto-flow: rows dense; //dense 尽量填充满空格