Name

Style — an HTML <style> element

Inherits from

Node, Element

Synopsis

A Style object represents an HTML <style> tag.

Properties

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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.