欢迎来到DIVCSS5查找CSS资料与学习DIV CSS布局技术!
    flex布局为"弹性布局",任何一个元素都可以通过设置css属性display:flex;webkit内核浏览器为display:-webkit-flex;
    指定元素为Flex布局。
    采用Flex布局的元素,称之为"容器"(flexcontainer),它其中的所有的子元素称之为Flex项目(flexitem);
    容器的属性
    flex-direction
    项目的排列方向选择值:row(默认值:左到右)|row-reverse(右到左)|column(上到下)|column-reverse(下到上)
    .box{
    flex-direction:row|row-reverse|column|column-reverse;
    }
    flex-wrap
    定义项目是否要换行选择值:nowrap(默认值:不换行)|wrap(换行,第一行在上方)|reverse-wrap(换行,第一行在下方)
    .box{
    flex-wrap:nowrap|wrap|wrap-reverse;
    }
    flex-flow
    是flex-direction属性和flex-wrap属性的简写形式,默认值为rownowrap
    .box{
    flex-flow:<flex-direction>||<flex-wrap>;
    }
    justify-content
    定义项目在主轴上的对齐方式。选择值flex-start(默认值左对齐)|flex-end(右对齐)|center(居中)|space-between(两端对齐)|space-around(每个项目间隔相等)
    .box{
    justify-content:flex-start|flex-end|center|space-between|space-around;
    }
    align-items
    定义项目在交叉轴上如何对齐。选择值flex-start(交叉轴的起点对齐)|flex-end(交差轴的终点对齐)|center(交叉轴的中点对齐)|baseline(项目的第一行文字的基线对齐)|stretch(项目未设置高度或设为auto,将占满整个容器的高度)
    .box{
    align-items:flex-start|flex-end|center|baseline|stretch;
    }
    align-content
    定义了多根轴线的对齐方式。如果项目只有一根轴线,该属性不起作用。
    .box{
    align-content:flex-start|flex-end|center|space-between|space-around|stretch;
    }
    项目的属性
    order
    .item{
    order:<integer>;
    }
    flex-grow
    .item{
    flex-grow:<number>;/*default0*/
    }
    flex-shrink
    .item{
    flex-shrink:<number>;/*default1*/
    }
    flex-basis
    .item{
    flex-basis:<length>|auto;/*defaultauto*/
    }
    flex
    .item{
    flex:none|[<'flex-grow'><'flex-shrink'>?||<'flex-basis'>]
    }
    align-self
    .item{
    align-self:auto|flex-start|flex-end|center|baseline|stretch;
    }






本文转载自中文网


 

如需转载,请注明文章出处和来源网址:http://www.divcss5.com/css3-style/c57319.shtml