row
margin: auto
is an alternative to justify-content: center
and align-items: center
.
Instead of this code on the flex container:
.container {
justify-content: center;
align-items: center;
}
We can use margin: auto
the flex item:.container div {
margin: auto;
}
(when there is only one flex item)no-wrap
is the default value of the property@media (min-width: 900px) {
.container {
display: flex;
justify-content: space-between;
}
}
margin-right
property:.container div {
margin-right: 40px;
}
.container div:last-child {
margin-right: 0px;
}
Flex way of space between flex items:.container {
display: flex;
justify-content: space-between;
}
.container div {
flex-basis: 30%;
}
stretch
that means all the flex items will be stretched vertically as default.container {
display: flex;
align-items: stretch;
}
0
. Negative numbers are also accepted.main-column {
flex: 3;
order: 2;
}
.sidebar-one {
flex: 1;
order: 1;
}
flex
property is a shorthand for flex-grow
, flex-shrink
, and flex-basis
.
In this case the element with the property is going to take all the available width.