HTML and CSS Reference
In-Depth Information
Examples
p {margin: 15pt;} /* all sides 15pt */
#div1 {margin: 20px 10px;} /* 20px top-bottom, 10px left-right */
#div2 {margin: 10px 10px 5px 10px;}
/* 10px top, 10px right 5px bottom, 10px left */
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-bottom
This property sets an element's bottom margin.
Syntax
margin-bottom: 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 .
Examples
p {margin-bottom: 10pt;}
.tight {margin-bottom: 0;}
#spec {margin-bottom: 10%;}
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-left
This property sets an element's left margin.
Syntax
margin-left: 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 .
Search WWH ::




Custom Search