Body backgroundPropiedades
Objeto Body
Definición y uso
La propiedad background puede establecer o devolver el valor del atributo background del elemento body.
La propiedad background describe la imagen de fondo del documento.
Sintaxis
bodyObject.background=URL
Soporte del navegador
![]()
![]()
![]()
![]()
![]()
Todos los navegadores principales admiten la propiedad background.
Ejemplo
Ejemplo
Devuelve el valor del atributo background del elemento body:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Ejemplo (example.com)</title>
</head>
<body id="logo" background="logo.png">
<script>
document.write("La imagen de fondo es: ")
document.write(document.getElementById("logo").background);
</script>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>Ejemplo (example.com)</title>
</head>
<body id="logo" background="logo.png">
<script>
document.write("La imagen de fondo es: ")
document.write(document.getElementById("logo").background);
</script>
</body>
</html>
Pruébalo »
Objeto Body Otras extensiones