¿Cómo cambio la propiedad de fondo del html? Pude cambiar el fondo del elemento del cuerpo, pero quiero manipular la "etiqueta" html (?).
Código para manipular el fondo del cuerpo.
document.body.style = 'background: radial-gradient(circle, rgba(131,170,203,1) 4%, rgba(69,113,148,1) 50%, rgba(39,71,97,1) 100%);';Estos intentos no funcionaron
document.html.style = 'background: red'; document.style = 'background: red';quiero cambiar esta parte
html { font-family: Arial, Helvetica, sans-serif; color: white; -webkit-user-drag: none; user-select: none; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none; background: radial-gradient(circle, rgba(131,170,203,1) 4%, rgba(69,113,148,1) 50%, rgba(39,71,97,1) 100%); }Debe usar document.documentElement.style para apuntar al elemento html .
document.body.style = 'background: radial-gradient(circle, rgba(131,170,203,1) 4%, rgba(69,113,148,1) 50%, rgba(39,71,97,1) 100%);'; document.documentElement.style = 'background: red'; <html> <body> <p>test</p> </body> </html>cambie el fondo por javascript en la etiqueta html intente esto:
document.getElementsByTagName('html')[0].style.background="radial-gradient(circle, rgba(131,170,203,1) 4%, rgba(69,113,148,1) 50%, rgba(39,71,97,1) 100%)";simplemente coloque un background-div en el DOM y manipúlelo. Por ejemplo, posición: absoluta / índice z: -1