margin-top property
Specifies the top margin of the object.
With the margin-top property you can specify the distance between the element's topmost position and the top border-bottom.
JavaScript page for this property: marginTop. You can find other example(s) there. |
Possible values:
One of the following values:
Default. The sizes of the 'auto' margins are equal. | |||||||
The height of the top margin in length units. For the supported length units, see the length page. | |||||||
The height is the specified percentage of the width of the parent element. | |||||||
Takes the value of this property from the computed style of the parent element. |
Default: 0.
Example HTML code 1:
|
||||
<head> <style> .outer { border: 1px solid #ffffff; background-color: #ffb08a; } .middle { margin-top: 20px; padding: 20px; border: 10px solid #000000; background-color: #ceb379; } .inner { height: 10px; border: 1px solid #ffffff; background-color: #ffffff; } </style> </head> <body> <table cellpadding="0px" cellspacing="10px"> <tr> <td style="background-color: #ffb08a;"> </td> <td>margin</td> <td style="background-color: #000000;"> </td> <td>border</td> <td style="background-color: #ceb379;"> </td> <td>padding</td> </tr> </table> <div class="outer"> <div class="middle"> <div class="inner"></div> </div> </div> </body> |
||||
|
||||
Did you find this example helpful?
|
Supported by tags:
a, abbr, acronym, address, applet, b, bdo, big, blink, blockQuote, body, button, caption, center, cite, code, dd, del, dfn, dir, div, dl, dt, em, embed, fieldSet, font, form, frameSet, H1, H2, H3, H4, H5, H6, hr, html, i, iframe, img, input:button, input:checkbox, input:file, input:image, input:password, input:radio, input:range, input:reset, input:search, input:submit, input:text, ins, isIndex, kbd, label, legend, li, listing, marquee, menu, nobr, object, ol, optGroup, option, p, plainText, pre, q, rt, ruby, s, samp, select, small, span, strike, strong, sub, sup, table, td, textArea, th, tt, u, ul, var, xmp
Related pages:
External links:
margin-top (MSDN)
margin-top (Mozilla Developer Center)
margin-top (Safari Reference Library)
margin-top (W3C)
margin-top (Mozilla Developer Center)
margin-top (Safari Reference Library)
margin-top (W3C)
User Contributed Comments