I use root css to set my background image. It is supported by all other browser but in IE 9+ I am not able to apply background image to css. May be browser is supported for root css. I am setting root css variable using javascript. I use LESS and Sass css also but did'nt get any way to set css global variable via javascript or JQuery. This is my css code:-
:root{
--mainbgimage: url("image.jpg");
}
body{
background-image: var(--mainbgimage);
}
Is there any way to make this code supported for IE browser Javascript code
var image = // image fetched from database;
document.documentElement.style.setProperty("--mainbgimage", image);