Body backgroundPropriété
Objet Body
Définition et utilisation
La propriété background définit ou renvoie la valeur de l'attribut background de l'élément body.
La propriété background décrit l'image d'arrière-plan du document.
Syntaxe
bodyObject.background=URL
Prise en charge des navigateurs
![]()
![]()
![]()
![]()
![]()
Tous les principaux navigateurs prennent en charge la propriété background.
Exemple
Exemple
Renvoie la valeur de l'attribut background de l'élément body :
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Tutoriel d'exemple (example.com)</title>
</head>
<body id="logo" background="logo.png">
<script>
document.write("The background image is: ")
document.write(document.getElementById("logo").background);
</script>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>Tutoriel d'exemple (example.com)</title>
</head>
<body id="logo" background="logo.png">
<script>
document.write("The background image is: ")
document.write(document.getElementById("logo").background);
</script>
</body>
</html>
Essayez-le vous-même »
Objet Body Autres extensions