margin
Description: sets the overall margin of an element.
Syntax:
margin : <length>;
sets the over all margin size
margin : 5em;
The margin will be 5 ems
margin : 10%
The margin will be 10% of the width of the parent element.
margin : 5px 10px 15px 20px;
The top margin will be 5 pixels, the right 10, the bottom 15 and the left 20
Browsers Supported:
.Netscape 4 - PC
.Netscape 4 - Mac
.Internet Explorer 4 - PC
.Internet Explorer 4 - Mac
.Internet Explorer 5 - PC
.Internet Explorer 5 - Mac
.Internet Explorer 5.5 - PC
.Opera 3
.Opera 4
Examples:
<body style="margin : 12px;">
<p style="margin : 20px;">
This paragraph has a margin of 20 pixels,
but the h3 tag below is part of the paragraph so it will have a
margin of 10% the width of this paragraph. <h3 style="margin : 10%">
Note also that the margin tag affects all four margins around the h3 tag equally.
<p style="margin : 5px 25px 10px 35px;>
While this paragraph has different margins for all four sides.
Notes:
- vertically adjacent margins collapse to be as large as the largest margin
- inline elements don't really use the margin property
- margins set on floated elements are never collapsed
- negative values are permitted, but can result in some really strange pages
Related Resources:
margin-left
margin-right
margin-top
Using Tables to Do Page Layout
How to build a complex table to affect the layout of your site.
Web Design
Links to creating good looking web pages using html fundamentals and Web design guidelines.
|