Mwongozo wa kubadilika ya mawaka
- Kwanza zaidi margin
- Pya zaidi marginLeft
- Kutumia mawingu juu Kifungu cha HTML DOM Style
Definition and usage
marginBottom
property sets or returns the element's outer margin bottom.
margin property and padding property All insert space around the element. However, the difference is that margin inserts space around the border, while padding inserts space inside the element's border.
See also:
CSS Tutorial:Ukijua wa CSS wa kifungu
CSS Reference Manual:margin-bottom property
HTML DOM Reference Manual:margin property
Instance
Example 1
Set the outer margin bottom of the <div> element:
document.getElementById("myDiv").style.marginBottom = "50px";
Example 2
Change the outer margin bottom of the <div> element back to "normal":
document.getElementById("myDiv").style.marginBottom = "0px";
Example 3
Return the outer margin bottom of the <div> element:
alert(document.getElementById("myDiv").style.marginBottom);
Example 4
Difference between marginBottom and paddingBottom:
function changeMargin() { document.getElementById("myDiv").style.marginBottom = "100px"; } function changePadding() { document.getElementById("myDiv2").style.paddingBottom = "100px"; }
Syntax
Return marginBottom property:
object.style.marginBottom
Set marginBottom property:
object.style.marginBottom = "%|length|auto|initial|inherit"
Attribute value
Value | Description |
---|---|
% | Define the outer margin bottom as a percentage of the parent element's width. |
length | Define the outer margin bottom with a length unit. |
auto | Browser settings for the outer margin bottom. |
initial | Sets this property to its default value. See also initial. |
inherit | Inherits this property from its parent element. See also inherit. |
Technical details
Default value: | 0 |
---|---|
Return value: | String that represents the element's outer margin bottom. |
CSS Version: | CSS1 |
Muungaji wa kifungu
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Msaada | Msaada | Msaada | Msaada | Msaada |
- Kwanza zaidi margin
- Pya zaidi marginLeft
- Kutumia mawingu juu Kifungu cha HTML DOM Style