(either side shrinks twice as fast as center)
(either side does not shrink at all)
(center shrinks twice as fast as either side)
display: flex
changes an element to a block-level container with flex items inside of it.
display: inline-flex
allows multiple flex containers to appear inline with each other.
justify-content
is used to space items along the main axis.
align-items
is used to space items along the cross axis.
flex-grow
is used to specify how much space (and in what proportions) flex items absorb along the main axis.
flex-shrink
is used to specify how much flex items shrink and in what proportions along the main axis.
flex-basis
is used to specify the initial size of an element styled with flex-grow and/or flex-shrink.
flex
is used to specify flex-grow, flex-shrink, and flex-basis in one declaration.
flex-wrap
specifies that elements should shift along the cross axis if the flex container is not large enough.
align-content
is used to space rows along the cross axis.
flex-direction
is used to specify the main and cross axes.
flex-flow
is used to specify flex-wrap and flex-direction in one declaration.
Flex containers can be nested inside of each other by declaring
display: flex or display: inline-flex for children of flex containers.
See the code in index.html for more
but for a brief explanation:-
In the <style> area at the top of my form I included...
/*Start with both boxes maintain a width of 45%*/
.flexBlock {
width:45%;
}
/*set this to NOWRAP now - it is the default so it's not necessary but I wanted to show it.
change to wrap (in the @media command) when screen size shrinks. */
.flexContainer {
flex-wrap: nowrap;
}
@media only screen and (max-width: 900px) {
/*when screen size drops below 900px make the width 95%*/
/*So it will now show 1 div box instead of 2 wide...
(flex-wrap must change to 'wrap' - see.flexContainer below) */
.flexBlock {
width: 95%;
}
/*When screen size drops below 900px this makes sure the 2 boxes wrap.*/
.flexContainer {
flex-wrap: wrap;
}
}
/*Above here is the code for making the flexbox change it's size and then drop to single boxes*/
Then on the parent (div) container I allocate the class flexContainer
and on the children (div's) I allocate the class flexBlock