Style paddingRight Eigenschaft
- Vorherige Seite paddingLeft
- Nächste Seite paddingTop
- Zurück zur vorherigen Ebene HTML DOM Style-Objekt
Definition and usage
paddingRight
Sets or returns the right inner padding of an element.
margin property and padding property They both insert space around the element, but the difference is that margin inserts space around the border, while padding inserts space inside the element's border.
See also:
CSS Tutorial:CSS-Innenabstand
CSS Reference Manual:padding-right property
HTML DOM Reference Manual:padding property
Example
Example 1
Set the right inner padding of the <div> element:
document.getElementById("myDIV").style.paddingRight = "50px";
Example 2
Reset the right inner padding of the <div> element to "normal":
document.getElementById("myDIV").style.paddingRight = "0px";
Example 3
Returns the right inner padding of the <div> element:
alert(document.getElementById("myDIV").style.paddingRight);
Example 4
Difference between marginRight and paddingRight:
function changeMargin() { document.getElementById("myDIV").style.marginRight = "200px"; } function changePadding() { document.getElementById("myDIV2").style.paddingRight = "200px"; }
Syntax
Return the paddingRight property:
object.style.paddingRight
Set the paddingRight property:
object.style.paddingRight = "%|length|initial|inherit"
Property value
Value | Description |
---|---|
% | Right inner padding is defined as a percentage of the parent element's width. |
length | Right inner padding is defined with length units. |
initial | Sets this property to its default value. See initial. |
inherit | Inherits this property from its parent element. See inherit. |
Technical details
Default value: | 0 |
---|---|
Return value: | A string that represents the right inner padding of an element. |
CSS Version: | CSS1 |
Browser support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Unterstützung | Unterstützung | Unterstützung | Unterstützung | Unterstützung |
- Vorherige Seite paddingLeft
- Nächste Seite paddingTop
- Zurück zur vorherigen Ebene HTML DOM Style-Objekt