DisplayProperty
inlineanything that can be placed in a single line.
E.g.: Images, text, links etc. They go in a single flow and wrap (or don’t) at the end of every line
blockthey change the default behavior of inline. They treat themselves as block elements, start on a new line and take up all existing width
flexthis is a flexible display property, helpful in creating layouts.
Its elements can be aligned and distributed horizontally or vertically
gridallows us to create grid systems, and control positioning of grid items
inline-blockthey behave like inline elements but we can set their width, height, padding, margins etc
table-rowmakes the element behave like a <tr></tr> element
noneremoves the element completely
initialback to the default value
inheritinherit the property from parent

Takeaways and Uses

  • if you want to center an image (which by default is an inline element) turn it into a block and so now you can set padding for them
  • if you want to align elements in a straight line (horizontally or vertically), use a flex box
  • use a grid to make good compartmentalized UI
  • use an inline-block if you want to get elements that look different (too big or too small) but are present in the middle of a line.