huoxiangdong / Blog

学习记录
0 stars 0 forks source link

Grid布局 & Flex布局 #61

Open huoxiangdong opened 6 years ago

huoxiangdong commented 6 years ago
display grid  // 声明
// 显示网格线
grid-template-rows // 创建行网格线
grid-template-columns  // 创建列网格线
// 隐示网格线
grid-auto-rows
grid-auto-columns
huoxiangdong commented 6 years ago
huoxiangdong commented 6 years ago
huoxiangdong commented 6 years ago
huoxiangdong commented 6 years ago
huoxiangdong commented 6 years ago
huoxiangdong commented 6 years ago
// Grid属性列表
display
grid-template-columns
grid-template-rows
grid-template-areas
grid-template
grid-column-gap
grid-row-gap
grid-gap
justify-items
align-items
justify-content
align-content
grid-auto-columns
grid-auto-rows
grid-auto-flow
grid
huoxiangdong commented 6 years ago
// Grid Items 属性列表
grid-column-start
grid-column-end
grid-row-start
grid-row-end
grid-column
grid-row
grid-area
justify-self
align-self
huoxiangdong commented 6 years ago
huoxiangdong commented 6 years ago
huoxiangdong commented 6 years ago
grid: none | <grid-template-rows> / <grid-template-columns> | <grid-auto-flow> [<grid-auto-rows> [/ <grid-auto-columns>]]
huoxiangdong commented 6 years ago

!!!!! 区别 控制

  • 一维布局
  • 二维布局
huoxiangdong commented 6 years ago

Flex布局

display: flex;
flex-wrap: wrap; // 自动换行
huoxiangdong commented 6 years ago

box-sizing: border-box;

huoxiangdong commented 6 years ago
flex: flexflex-grow // 放大比
        flex-shrink  // 缩放比
        flex-basis // 宽高
// 默认值为0 1 auto // 0 不均分 1 均分 auto 原始大小
// auto (1 1 auto) 和 none (0 0 auto)