YouTip LogoYouTip

Prop Style Marginbottom

# Style marginBottom Property [![Image 8: Style Object Reference](#) Style Object](#) * * * ## Definition and Usage The marginBottom property sets or returns the bottom margin of an element. ## Syntax Set the marginBottom property: Object.style.marginBottom="_%_|_length_|auto|inherit" Return the marginBottom property: Object.style.marginBottom | Value | Description | | :--- | :--- | | _%_ | Defines the bottom margin in percent of the width of the parent element. | | _length_ | Defines the bottom margin in px, cm, etc. | | auto | The browser calculates the bottom margin. | | inherit | The bottom margin is inherited from the parent element. | * * * ## Browser Support ![Image 9: Internet Explorer](#)![Image 10: Firefox](#)![Image 11: Opera](#)![Image 12: Google Chrome](#)![Image 13: Safari](#) All major browsers support the marginBottom property. **Note:** IE7 and earlier versions do not support the "inherit" value. IE8 only supports "inherit" if a !DOCTYPE is specified. IE9 supports "inherit". * * * ## Tips and Notes The margin property and the padding property both insert space around an element. However, the difference is that margin will insert space outside the border, while padding will insert space inside the border. * * * ## Example ## Example Change the bottom margin of a div element: div{ border: 1px solid #FF0000; } function changeMargin(){ document.getElementById("ex1").style.marginBottom="100px"; } function changePadding(){ document.getElementById("ex2").style.paddingBottom="100px"; }
This is some text.



This is some text.

[Try it Β»](#) * * Style Object](#)
← Prop Style MaxwidthProp Style Margin β†’