Skip to content

A guide to understanding flexbox in depth with practical examples

License

Notifications You must be signed in to change notification settings

npranto/understanding-flexbox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

understanding-flexbox

A guide to understanding flexbox in depth with practical examples

Visual Guide

Table of Contents


Flexbox

Breaking Down Flexbox Model

  • Flex Container: The parent container to which you set flexible display to.
  • Flex Item(s): The child elements that are residing inside the parent flexible container.

Flex Container Properties

flex-direction

flex-wrap

  • controls the flow of flex items and whether or not they should be forced into a single line or wrapped in multiple lines (despite the number of flex items)
  • flex-wrap property values:

flex-flow

justify-content

align-items

align-content

Flex Item Properties

order

  • controls the order of flex items to be displayed
  • default value is 0, but can take in both positive and negative integer values
  • works similar to z-index, order of content goes from lowest order integer to highest
  • order property values:

flex-grow AND flex-shrink

  • controls the amount of space a flex item can take in, squeeze in based on available space
  • flex grow expands content to full extent of parent element horizontally
  • flex shrink shrinks content to its default size if there is available space or if there is no space, it shrinks content to fit within parent element
  • default value is 0, but it can also be any positive integer
  • flex-grow and flex-shrink property values:

flex-basis

  • specifies an initial size of flex items, but it can altered with flex-grow and flex-shrink
  • default value is 'auto,' but it can also be any size attribute(px, em, % etc.)
  • flex-basis property values:

flex

  • a shorthand for flex-shrink, flex-grow and flex-basis all together
  • an simple example could be flex: 0 1 auto, 0 is flex-grow, 1 is flex-shrink, and auto is flex-basis
  • flexproperty values:

align-self

auto-margin-alignment

About

A guide to understanding flexbox in depth with practical examples

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published