Propriété paddingRight de style
Exemple
Définissez le bon rembourrage d'un élément <div> :
document.getElementById("myDIV").style.paddingRight = "50px";
Définition et utilisation
La propriété paddingRight définit ou renvoie le remplissage droit d'un élément.
La propriété margin et la propriété padding insèrent toutes deux un espace autour d'un élément. Cependant, la différence est que margin insère l'espace autour de la bordure, tandis que padding insère l'espace dans la bordure d'un élément.
Prise en charge du navigateur
Property | |||||
---|---|---|---|---|---|
paddingRight | Yes | Yes | Yes | Yes | Yes |
Syntaxe
Renvoyez la propriété paddingRight :
object.style.paddingRight
Définissez la propriété paddingRight :
object.style.paddingRight = "%|length|initial|inherit"
Valeurs de propriété
Value | Description |
---|---|
% | Defines the right padding in % of the width of the parent element |
length | Defines the right padding in length units |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
Détails techniques
Valeur par défaut: | 0 |
---|---|
Valeur de retour : | Une chaîne, représentant le bon rembourrage d'un élément |
Version CSS | CSS1 |
Plus d'exemples
Exemple
Changez le rembourrage droit d'un élément <div> en "normal":
document.getElementById("myDIV").style.paddingRight = "0px";
Exemple
Renvoie le bon rembourrage d'un élément <div> :
alert(document.getElementById("myDIV").style.paddingRight);
Exemple
Différence entre marginRight et paddingRight :
function changeMargin() {
document.getElementById("myDIV").style.marginRight = "200px";
}
function changePadding() {
document.getElementById("myDIV2").style.paddingRight = "200px";
}
Pages connexes
Tutoriel CSS : Remplissage CSS
Référence CSS : propriété padding-right
Référence HTML DOM : propriété padding
❮ Objet de style