Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flex布局 #3

Open
MAJIANYANG666 opened this issue May 7, 2017 · 0 comments
Open

flex布局 #3

MAJIANYANG666 opened this issue May 7, 2017 · 0 comments

Comments

@MAJIANYANG666
Copy link
Owner

MAJIANYANG666 commented May 7, 2017

flex之前

我们用什么布局
主要使用(5种):

  • normal flow
  • float+flow
  • position relative+absolute
  • dispaly inline-block
  • 负margin

基本概念

50_WQ_AE{{1V05WP1KV1UO9.png
主轴main axis主尺寸main size主轴起点main start主轴终点main end
侧轴cross axis侧尺寸cross size侧轴起点cross start侧轴终点cross end

flex来了

一种新的布局方式——Flex布局

  1. 块级布局侧重垂直方向,行内布局侧重水平方向,flex布局是与方向无关
  2. flex布局可以实现空间自动分配自动对齐(flexible:弹性,灵活)
  3. flex适用于简单的线性布局,更复杂的布局要交给grid布局(还没发布)

flex container的属性

  • flex-direction方向
    flex-direction:low/column/low-reverse/column-reverse
  • flex-wrap换行
    flex-wrap:warp/nowarp
  • flex-flow上面两个的简写
  • jusitify-content主轴方向对齐方式
    jusitify-content:space-between/space-around/flex-start/flex-end/center
  • align-items侧轴对齐方式
    align-items:strech/baseline/flex-start/flex-end/center
  • align-content多行列内容对齐方式
    align-content:strech/space-between/space-around/flex-start/flex-end/center

flex item的属性

  • flex-grow增长比例(空间过多时)
    flex-grow:1
  • flex-shrink收缩比例(空间不够时)
    flex-shrink:1
  • flex-basis默认大小(一般不用)
    flex-basis:100px
  • flex上面三个的缩写
    order顺序(代替双飞翼)
    order:1
  • align-self自身对齐方式
    align-self:center
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant