The Difference Between Display Block And Display Inline
Some (most?) elements on a web page occupy a rectangular area of the page. Such elements can be block-level elements, or inline-level elements. There are other types that they can be, but this page will focus on just block-level and inline-level, because those two are perhaps the most common.
What is a block-level element?
Additionally, if a block-level element has a top or bottom margin, those margins will distance the block-level element from elements above and below it, respectively. However, if the elements above and below the block-level element have their own margins that touch the block-level element, those vertical margins will "collapse," or, in other words, will overlap such that the space between the elements will only be as big as the largest margin between them.
Block-level elements can be made to float, but for float to have any actual effect on a block-level element, the block-level element must be given a width that is smaller than the block that contains it. If a block-level element is floating to the left, then any inline elements that appear after it in the source code will appear to the right of the floating block. Additionally, a block-level element that comes after the floating block will appear to the right of the floating block if its width is small enough to allow it to fit.
