CSS flex by Ciro Santilli 34 Updated +Created
  • css/flex.html: illustrates basic flex usage, including:
  • flex-grow: if there's space left, this determines how much extra space will be given to each.
  • flex-basis: the size the items want to be. But if there isnt' enough space, this can be cut up.
    Note that the minimal space required by children of the flex children cannot be necessarily cut up, and might lead things to overflow out of the container.
  • flex-shrink: if there's space missing, this determines how much extra space will be removed from each flex-basis
Other examples include:
That example calculates and displays the final widths via JavaScript, making it easier to understand the calculations being done.