Posts in current category

CSS Margin (Margin)

May 03, 2021 22:00 CSS

Table of contents

CSS Margin (margin).

The CSS Margin property defines the space around the element.

The CSS Margin property accepts any unit of length, percentage value, or even negative value.


Margin clears the area around the element (the outer border). Margin has no background color and is completely transparent

Margin can change the upper, bottom, left, and right margins of elements individually. You can also change all the properties at once.

Possible values

Value Description
auto Set the browser margin.
The result of this depends on the browser
length Define a fixed margin (using pixels, pt, em, etc.)
% Defines a margin that uses a percentage

CSS Margin (Margin) Margin can use negative, overlapping content.