Cross Browser support for CSS Flexbox

I have been using the code mentioned below, it works on my Chrome but not on my IE9 and Safari.

I googled for the solution, despite I got various vendor prefixes, those results are baffling me.

<div style="display: flex; flex-direction: row;">
    <div></div>
    <div></div>
</div>

CSS Flexbox model is optimised for UI Design. It is developed primarily to avoid overflowing parent element. It will shrink children when ancestor element size is constricted. It will fill the space by expanding child element's size when ancestor element size extends. Flex container shrink and expand behaviour can break with min and max width / height property.

CSS FlexBox versions by version

W3 2009 : display: box;

box-align                start | end | center | baseline | stretch  
box-direction            normal | reverse | inherit
box-flex                 <number>   0.0
box-flex-group           <integer>  1
box-lines                single | multiple
box-ordinal-group        <integer>  1   visual
box-orient               horizontal | vertical | inline-axis | block-axis | inherit inline-axis box elements    no  no  visual
box-pack                 start | end | center | justify 

W3 2011 : display flexbox | inline-flexbox

flex-align        auto | baseline   auto
flex-direction    lr | rl | tb | bt | inline | inline-reverse | block | block-reverse   flexboxes   no  lr | rl | tb | bt
flex-order        <integer> 1   
flex-pack         start | end | center | justify    

W3 2012 : display flex | inline-flex

align-content    flex-start | flex-end | center | space-between | space-around | stretch    
align-items      flex-start | flex-end | center | baseline | stretch
align-self       auto | flex-start | flex-end | center | baseline | stretch                 
flex-direction   row | row-reverse | column | column-reverse
flex-flow        <'flex-direction'> || <'flex-wrap'>    
flex-grow        <number>   ‘0’ 
flex-shrink      <number>   ‘1’
flex-wrap        nowrap | wrap | wrap-reverse
justify-content  flex-start | flex-end | center | space-between | space-around
order            <number>   0

To cover all Flexbox implementations, your CSS would look like this:

.foo {
  display: -webkit-box;
  display: -moz-box;
  display: -ms-flexbox;
  display: -webkit-flex;
  display: flex;
  -webkit-box-orient: horizontal;
  -moz-box-orient: horizontal;
  -webkit-box-direction: normal;
  -moz-box-direction: normal;
  -webkit-flex-direction: row;
  -ms-flex-direction: row;
  flex-direction: row;
}

Note, however, that specifying flex-direction: row is not necessary unless you're overriding a previous flex-direction declaration: row is the default direction. Also note that IE10 is the first version of IE to support Flexbox.


IE9-, unfortunately, doesn't support Flexbox at all. IE10 supports the 2011 version.

Opera 12.1+ supports the latest 2012 version unprefixed. It will also be supported by Chrome 30+ and IE11+. Firefox 22 already supports it, too, but only partially — it doesn't support flex-wrap property and flex-flow shorthand.

Previous versions of Firefox, Chrome, and Safari 3.1+ support 2009 version. Chrome 21+ also supports 2012 version with prefix.

链接地址: http://www.djcxy.com/p/75614.html

上一篇: 支持CSS3 @supports

下一篇: Cross Browser支持CSS Flexbox