CSS Margins:-

The margin property defines the space around an HTML element. It is possible to use negative values to overlap content.


CSS Margin Properties

Property        Description

margin        A short hand property for setting the margin.

margin-bottom    Sets the bottom margin of an element

margin-left    Sets the left margin of an element

margin-right    Sets the right margin of an element

margin-top    Sets the top margin of an element


Example:

<html>

<head>

<style type='text/css'>

h5

{

margin:2cm 4cm 3cm 4cm

}

</style>

</head>

<body>

<p>A paragraph with no specified margins.</p>

<h5>A paragraph with specified margins.</h5>

<p>A paragraph with no specified margins.</p>

</body>

</html>


margin-bottom    Sets the bottom margin of an element


Example:

<html>

<head>

<style type='text/css'>

h5

{

margin-bottom:2cm;

}

</style>

</head>

<body>

<p>A paragraph with no specified margins.</p>

<h5>A paragraph with specified margins.</h5>

<p>A paragraph with no specified margins.</p>

</body>

</html>