Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Style Object

HTML DOM Style Object


The Style object

The Style object represents an individual style declaration.

Access the Style Object

The Style object can be accessed from the head section of the document, or from a specified HTML element.

To access the style object from the head section of the document:

var x = document.getElementsByTagName("STYLE");

Try it

To access the style object of a specified element:

var x = document.getElementById("myH1").style;

Try it

Create the Style Object

You can use the document.createElement() method to create