This property corresponds to the margin-top and margin-bottom, or the margin-right and margin-left properties, depending on the values defined for writing-mode, direction, and text-orientation. The margin-block property may be specified using one or two values. When one value is specified, it applies the same margin to both start and end.
This property is a shorthand for the following CSS properties: This property corresponds to the margin-top and margin-bottom, or the margin-right and margin-left properties, depending on the values defined for writing-mode, direction, and text-orientation. The margin-block property may be specified using one or two values.
The margin property defines the outermost portion of the box model, creating space around an element, outside of any defined borders. Margins are set using lengths, percentages, or the keyword auto and can have negative values. Here’s an example: margin is a shorthand property and accepts up to four values, shown here:
Even with the element inside another element, when adding margin, it is as if I have added the margin in the parent element and not in the child. It's called collapsing margins, and that doesn't happen on inline blocks. Margins of inline-block boxes do not collapse (not even with their in-flow children).