CBSE Class 10 Computer Applications Question 49 of 56

Cascading Style Sheets (CSS) — Question 3

Back to all questions
3
Question

Question 3

How can we set the margins for an element?

Answer

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

Syntax — Margin : top-value right-value bottom-value left-value where value can be length or percentage or 'auto'.

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

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