Open main menu

CDOT Wiki β

Changes

CSS GUIDE MARGIN TOP

1,377 bytes added, 13:26, 22 November 2006
no edit summary
<span style="margin:0;background:#ffff33;font-size:120%;font-weight:bold;border:1px solid #a3b0bf;text-align:left;color:#000;padding:0.2em 0.4em;">This document is a work in progress and is subject to change.</span><br /><br />

== Summary ==
'''margin-top''' property sets the top margin of an element.

* Initial value: depends on user agent
* Applies to: all elements
* Inherited: no
* Percentages: yes, refers to the width of containing block
* Media: visual
* Computed value: as specified

== Syntax ==

<pre>
h1 { margin-top: value }
</pre>

== Legal Values ==

'''auto'''

The browser sets a top margin.

'''length'''

Defines a fixed top margin.

'''percentage'''

Defines a top margin in % of the total height of the document.

== Mozilla Recommended Values ==

== Usage Examples ==

<pre>
h1 { margin-top: 10px }
h2 { margin-top: -20px }
h3 { margin-top: 1em }
</pre>

<pre>
<p style="margin-top : 2em;">
This paragraph has a 2 em margin top.
</p>
</pre>

== Notes ==

* Negative values are allowed

== Specification Conformance ==

* [http://www.w3.org/TR/REC-CSS2/box.html#margin-properties CSS 2]

== Browser Compatibility ==

* Netscape 4, 6, 7
* Mozilla 1
* Firefox 1, 1.5, 2
* Internet Explorer 3, 4, 5, 6
* Opera 3, 4, 5, 6, 7, 8
* Safari 1

== See Also ==

* [http://webdesign.about.com/od/styleproperties/p/blspmargintop.htm More description and links]
1
edit