CSS - Margin

Margin

In this tutorial, I will be showing you how you can adjust the space around an element; outside its borders using the margin properties in CSS.

definition
DEFINITION:

Margin is the space around the content of an element outside the content's border.

Margin Properties

MARGIN TOP

The margin-top property is used to set the top margin of an element.

MARGIN RIGHT

The margin-right property is used to set the right margin of an element.

MARGIN BOTTOM

The margin-bottom property is used to set the bottom margin of an element.

MARGIN LEFT

The margin-left property is used to set the left margin of an element.

note
NOTE:

Margin can have values in %, px, auto, inherit and other absolute and relative unit values.


Margin (Shorthand)

ADVERTISEMENTS

LEARNING IS A CONTINOUS PROCESS - PRACTICE MAKES PERFECT