CSS MARGIN-TOP
This property controls the size of the top margin of an element’s rendering box. Negative values are allowed. Margins are transparent and the background value of the parent element shines through.
Collapsing margins: adjoining vertical margins between regular-flow elements may collapse; The larger of adjacent margin values is used. If the adjacent margins are all negative, the larger of the negative values is used. If positive and negative vertical margins are adjacent, the value should be collapsed thus: the largest of the negative margin values should be subtracted from the largest positive margin value.
Example
| address { margin-top: 33% }
<address style=”margin-top: 33%”>This is a test</address> |
Possible Values
| Value | Description |
|---|---|
| inherit | Explicitly sets the value of this property to that of the parent. |
| auto | This value specifies that a value determined by the browser be used for this property. |
| [length] | Refers to either an absolute measurement or a relative measurement based on the current element’s font size. |
| [percentage] | Refers to a percentage of the width of the current element’s containing block. |


3 Responses
[percentage] does not work for me
I don’t know why they use the width of the parent to specify the margin-top using percentage. It seems counter intuitive.
Width as a percentage should be a % of it’s parent’s width.
Height as a percentage “should” be a % of it’s parent’s height.
But is instead a % of it’s parent’s width. ???? Moronic.