Answers for "html dom style object reference"

CSS
1

add styles object js

document.getElementById("myElement").style.cssText = "display: block; position: absolute";
Posted by: Guest on November-07-2020
5

javascript style an element

// Getting the element first
var myElement = document.querySelector("#myElement");

// examples for updating styles
myElement.style.color = "blue";
myElement.style.backgroundColor = "red";
Posted by: Guest on September-02-2020

Browse Popular Code Answers by Language