Margin properties can have following values:
1. Length in cm, px, pt, etc.
2. Width % of the element.
3. Margin calculated by the browser: auto.
Syntax:
body
{
margin: size;
}
1. If the margin property has 4 values:
margin: 40px 100px 120px 80px;
1. top = 40px
2. right = 100px
3. bottom = 120px
4. left = 80px
Example:
<html>
<head>
<style>
p
{
margin:80px 100px 50px 80px;
}
</style>
</head>
<body>
<h1>
Bajarangi Soft
</h1>
<p>
Margin properties
</p>
</body>
</html>
<html>
<head>
<style>
p
{
margin:80px 50px 100px;
}
</style>
</head>
<body>
<h1>
Bajarangi Soft
</h1>
<p>
Margin properties
</p>
</body>
</html>
<html>
<head>
<style>
p
{
margin:100px 150px;
}
</style>
</head>
<body>
<h1>
Bajarangi Soft
</h1>
<p>
Margin properties
</p>
</body>
</html>
<html>
<head>
<style>
p
{
margin:100px;
}
</style>
</head>
<body>
<h1>
Bajarangi Soft
</h1>
<p>
Margin properties
</p>
</body>
</html>