HTML and CSS Reference
In-Depth Information
Examples
p {margin-left: 3em;}
.tight {margin-left: 0;}
#spec {margin-left: 15px;}
Compatibility
CSS 1, 2, 3 IE 4+ (buggy), 5+ Netscape 4+ (buggy), 6+, Firefox 1+ Opera 4+, Safari 1+
Note
• Elements may have default margins on them, and these values may vary by user
agent. Because of this inconsistency, many developers prefer to clear all margins
with a wildcard rule like * {margin: 0;} and build up individual values.
margin-right
This property sets an element's right margin.
Syntax
margin-right: length | percentage | auto | inherit
where the length is measured in any fixed measurement, such as inches ( in ) or pixels ( px ),
and may take a negative value. A percentage value is determined as a percentage of the width
of the containing block. The default value for the property is 0 .
Examples
p {margin-right: 1em;}
.tight {margin-right: 0;}
#spec {margin-right: 25px;}
Compatibility
CSS 1, 2, 3 IE 4+ (buggy), 5+ Netscape 4+ (buggy), 6+, Firefox 1+ Opera 4+, Safari 1+
Note
• Elements may have default margins on them, and these values may vary by user
agent. Because of this inconsistency, many developers prefer to clear all margins
with a wildcard rule like * {margin: 0;} and build up individual values.
margin-top
This property sets an element's top margin.
Syntax
margin-top: length | percentage | auto | inherit
where the length is measured in any fixed measurement, such as inches ( in ) or pixels ( px ),
and may take a negative value. A percentage value is determined as a percentage of the
height of the containing block. The default value for the property is 0 .
Search WWH ::




Custom Search