Stats France Decembre 2015
IE 8 | IE 9 | |
---|---|---|
PlayTV | 0.8% | 1% |
VDM | 1% | 1% |
BetaSeries | 0.001% | 0.002% |
Stats France Mars 2015
.container {
display: -webkit-box; /* Safari 3 to 7, Chrome 4 to 20, Android Browser */
display: -moz-box /* Firefox 2 to 21 */;
-webkit-box-direction: normal;
-moz-box-direction: normal;
-webkit-box-orient: horizontal;
-moz-box-orient: horizontal;
-webkit-box-align: start;
-moz-box-align: start;
}
.item {
-webkit-box-flex: 1;
-moz-box-flex: 1;
}
.container {
display: -ms-flexbox; /* IE 10 */
-ms-flex-flow: row;
-ms-flex-align: start;
}
.item {
-ms-flex: 1;
}
.container {
display: flex; /* since Chrome 29, Firefox 22, Safari 9 and IE11 */
display: -webkit-flex; /* Safari 7 to 8 and Chrome Android 4.4 */
flex-direction: row;
-webkit-flex-direction: row;
align-items: flex-start;
-webkit-align-items: flex-start;
}
.item {
flex: 1;
-webkit-flex: 1;
}
.container {
display: -webkit-box; /* Safari 3 to 7, Chrome 4 to 20, Android Browser */
display: -moz-box /* Firefox 2 to 21 */;
display: -ms-flexbox; /* IE 10 */
display: -webkit-flex; /* Safari 7 to 8 and Chrome Android 4.4 */
display: flex; /* since Chrome 29, Firefox 22, Safari 9 and IE11 */
-webkit-box-direction: normal;
-moz-box-direction: normal;
-webkit-box-orient: horizontal;
-moz-box-orient: horizontal;
-ms-flex-flow: row;
-webkit-flex-direction: row;
flex-direction: row;
-webkit-box-align: start;
-moz-box-align: start;
-ms-flex-align: start;
-webkit-align-items: flex-start;
align-items: flex-start;
}
.item {
-webkit-box-flex: 1;
-moz-box-flex: 1;
-ms-flex: 1;
-webkit-flex: 1;
flex: 1;
}
Il suffit de lui indiquer les navigateurs à supporter
browsers: ['> 1%', 'IE 10']
browsers: ['last 2 versions', 'Firefox >=10']
Meilleur support des syntaxes Flexbox que Compass
Il existe déjà beaucoup de plugins : Grunt, Gulp, Webpack, Less, Stylus, Rails …
Compatibilité Flexbox pour IE8 & IE9
.container {
-js-display: flex;
display: flex;
}
Ajoute des classes sur l'élément html
.no-flexbox.no-flexboxlegacy {
/* fallback */
}
.container {
display: flex;
/* flex-direction: row; */
}
.container {
display: flex;
flex-direction: column;
}
.container {
display: flex;
flex-direction: row-reverse;
}
À appliquer sur les flex-item, par defaut la valeur est à 0.
.item:nth-child(5) {
order: -1;
}
.item:nth-child(2) {
order: 1;
}
L'ordre dans le DOM défini l'ordre pour les flex-items de même order
.item:nth-child(4) {
order: 1;
}
.item:nth-child(2) {
order: 1;
}
.container {
display: flex;
justify-content: center;
}
.container {
display: flex;
justify-content: space-between;
}
.container {
display: flex;
justify-content: space-around;
}
.container {
display: flex;
height: 200px;
/* align-items: stretch; */
}
.container {
display: flex;
height: 200px;
align-items: center;
}
.container {
display: flex;
height: 200px;
align-items: flex-end;
}
.item:nth-child(3) {
align-self: stretch;
}
.container {
display: flex;
height: 200px;
}
.item:nth-child(3) {
margin-left: auto;
}
.container {
display: flex;
height: 200px;
}
.item:nth-child(1) {
margin-right: auto;
}
.item:nth-child(3) {
margin-left: auto;
}
.container {
display: flex;
height: 200px;
}
.item {
margin: auto;
}
Attribution de l'espace restant
.container {
display: flex;
}
.item:nth-child(4) {
flex-grow: 1;
}
.container {
display: flex;
}
.item:nth-child(4) {
flex-grow: 1;
}
.item:nth-child(5) {
flex-grow: 2;
}
Contraction par rapport à l'espace manquant
.container {
display: flex;
}
.item {
/* flex-shrink: 1; */
}
.container {
display: flex;
}
.item {
flex-shrink: 0;
}
.container {
display: flex;
}
.item {
flex-shrink: 0;
}
.item:nth-child(7) {
flex-shrink: 1;
}
.container {
display: flex;
}
.item {
flex-shrink: 0;
}
.item:nth-child(7) {
flex-shrink: 1;
}
.item:nth-child(8) {
flex-shrink: 2;
}
Taille avant redistribution d'espace
.container {
display: flex;
}
.item {
flex-basis: 150px;
}
.container {
display: flex;
}
.item {
flex-basis: 150px;
}
.item:nth-child(1) {
flex-grow: 1;
}
.container {
display: flex;
}
.item {
flex-basis: 150px;
flex-shrink: 0;
}
.item:nth-child(5) {
flex-shrink: 1;
}
.item {
flex-grow: 1;
flex-shrink: 1;
flex-basis: auto;
}
/* équivaut à */
.item {
flex: 1 1 auto;
}
.container {
display: flex;
}
.item {
flex: 1 0 150px;
}
.item:nth-child(2) {
min-width: 250px;
}
.item:nth-child(4) {
max-width: 50px;
}
.container {
display: flex;
flex-wrap: wrap;
}
.item {
flex: 1 0 150px;
}
h3 {
display: flex;
align-items: center;
}
h3::before,
h3::after {
content: "";
border-bottom: solid black 1px;
flex-grow: 1;
}
Lorem ipsum
Dolore
.media {
display: flex;
}
.media-body {
display: flex;
flex-wrap: wrap;
align-items: baseline;
}
.media-image {
flex-shrink: 0;
}
.media-name {
flex: 1 0 auto;
}
.media-text {
flex: 1 0 100%;
}
Images can have different sizes
Ratio 2:3
Assassination Classroom
Tome 8
…
.manga-group {
display: flex;
flex-wrap: wrap;
margin: 0;
padding: 10px;
justify-content: space-around;
}
.manga-item {
background-color: yellow; // pour mieux comprendre
margin: 10px;
}
.manga-item__image {
max-height: 300px;
}
.manga-item {
flex: 0 0 200px;
}
.manga-item {
display: flex;
flex-direction: column;
align-items: center;
justify-content: flex-end;
}
.manga-item__image {
max-width: 100%;
}
.manga-item {
flex: 0 0 200px;
max-width: 200px; //fix bug firefox
}
Assassination Classroom
Tome 8
.manga-item__place-image {
max-width: 100%;
flex: 0 0 auto;
}
.manga-item__image {
display: block;
}
Freelance Front-end
React.js • Mobile First • Hybrid & Progressive Web Apps