Style — an HTML <style> element

Inherits from

Node, Element


A Style object represents an HTML <style> tag.


boolean disabled

Set this property to true to disable the stylesheet associated with this <style> element, and set it to false to re-enable it.

string media

This property mirrors the HTML media attribute and specifies the mediums to which the specified styles apply.

boolean scoped

This property is true if the HTML scoped attribute is present on the <style> element, and false otherwise. At the time of this writing, browsers do not support scoped stylesheets.

readonly CSSStyleSheet sheet

The CSSStyleSheet defined by this <style> element.

string title

All HTML elements allow a title attribute. Setting this attribute or property on a <style> element may allow the user to select the stylesheet (as an alternate stylesheet) by title, and the title you specify may appear within the web browser UI in some fashion.

string type

Mirrors the HTML type attribute. The default value is “text/css”, and you do not normally need to set this attribute.

Get JavaScript: The Definitive Guide, 6th Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.