Flex布局

flex布局前提条件--display: flex(react native 不用设置)

  1. 与flex布局相关的属性有以下几个:(说几个主要的)
  • flex-direction 主轴方向
    • row (default value)web开发
    • row-reverse
    • column (default value)react native开发
    • column-reverse
  • justify-content 容器内的元素在主轴方向的排列方式
    • flex-start (default value)
    • flex-end
    • center
    • space-between
    • space-around
  • align-items 容器内的元素在交叉轴方向的排列方式
    • flex-start
    • flex-end
    • center
    • stretch (default value)
  • align-content(注意:容器内必须有多行的项目,该属性才能渲染出效果。今天只讨论单行的情况,也就是不换行,flex-wrap: no-wrap)
  • flex-wrap

下面说说flex-direction: row,row-reverse的情况,column,column-reverse以此类推

灰色画布 宽1200px 高 600px

cyan色矩形块 宽250px 高 100px

  • flex-direction: row

  • justify-content: flex-start; alignItems: flex-start;

Screen Shot 2019-08-31 at 00.20.34.png
  • justify-content: flex-start; alignItems: center
Screen Shot 2019-08-31 at 00.23.09.png
  • justify-content: flex-start; alignItems: flex-end


    Screen Shot 2019-08-31 at 00.23.40.png

  • justify-content: flex-start; alignItems: center;
Screen Shot 2019-08-31 at 00.39.05.png
  • justify-content: flex-end; alignItems: center;
Screen Shot 2019-08-31 at 00.29.15.png
  • justify-content: center; alignItems: center;
Screen Shot 2019-08-31 at 00.39.39.png
  • justify-content: space-between; alignItems: center;
Screen Shot 2019-08-31 at 00.40.47.png
  • justify-content: space-around; alignItems: center;
Screen Shot 2019-08-31 at 00.41.16.png

暂时写这么多 可以一起探讨呀

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 点这里 http://caibaojian.com/demo/flexbox/flex-direction.htm...
    木易先生灬阅读 688评论 0 1
  • /*! https://github.com/lzxb/flex.css */ [flex], [flex] > ...
    美滋滋213阅读 3,148评论 1 0
  • flex 1,flex布局又叫弹性布局,一个元素为flex布局时,子元素的float、clear和vertical...
    果粒橙没有粒阅读 458评论 0 4
  • 生命在于运动,前进的脚步不能停下,我们的身体如此,精神亦是如此!有曰,一天不读书,说话会变粗,两天不读书,智商会退...
    面之正阅读 243评论 0 0
  • 文 / 金泽香 人为什么需要四处走走,大约如此才能调剂一成不变的生活,让它起点无关紧要的微澜。就好比,早在秋分前,...
    金泽香阅读 583评论 4 6