KnowledgeBoat Logo
|

Computer Applications

Explain the purpose of using the shorthand Margin property.

CSS

10 Likes

Answer

We can specify the margins of all sides of an element in one single declaration by using the Margin shorthand property.

The syntax for shorthand Margin property is as follows:

Margin : top-value right-value bottom-value left-value;

where value = length | percentage | auto

For example, to define the margins for the <P> element, we will use the following rule:

P {margin: 20px 40px 60px 80px}

Answered By

5 Likes


Related Questions