DEV Community

Discussion on: Block vs inline vs inline-block

Collapse
 
alohci profile image
Nicholas Stimpson • Edited

If you really want to understand these display types, you need to stop reading w3schools and read better sources like MDN. You need to understand the difference between replaced and non-replaced elements, and between in-flow and out of-flow elements because replaced inline elements respect top and bottom margins, and out of flow block-level elements do not take up the full width of their container. There's also far more to the difference between inline and inline-block elements than those you've mentioned. Inline-block elements generate atomic boxes (i.e. they cannot be broken across lines), are block containers that always establish block formatting contexts and often inline formatting contexts for their children, and have substantially different rules around vertical alignment, to name three differences.