1.

How can we set the margins for an element on webpage? Name and explain 4 types ofmargin properties?

Answer»

Answer:

The margin property sets the margins for an element, and is a shorthand property for the following properties:

margin-top

margin-right

margin-BOTTOM

margin-LEFT

If the margin property has four values:

margin: 10px 5px 15px 20px;

top margin is 10px

right margin is 5px

bottom margin is 15px

left margin is 20px

If the margin property has three values:

margin: 10px 5px 15px;

top margin is 10px

right and left margins are 5px

bottom margin is 15px

If the margin property has two values:

margin: 10px 5px;

top and bottom margins are 10px

right and left margins are 5px

If the margin property has ONE value:

margin: 10px;

all four margins are 10px

Note: NEGATIVE values are allowed.

HOPE IT'LL HELP..



Discussion

No Comment Found