STYLE Element | style Object
Specifies a style sheet for a document.
Members Table
The following table lists the members exposed by the style object.
Attributes/Properties
Attribute Property Description canHaveChildren Gets a value indicating whether the object can contain child objects. constructor Returns a reference to the constructor of an object. DISABLED disabled Sets or retrieves a value that indicates whether the user can interact with the object. ID id Sets or retrieves the string identifying the object. MEDIA media Gets or sets the media type. scopeName Gets the namespace defined for the element. sheet ![]()
Gets the Cascading Style Sheets (CSS) style sheet that is associated with the object. styleSheet Retrieves an interface pointer that provides access to the style sheet object's properties and methods. tagUrn Sets or gets the Uniform Resource Name (URN) specified in the namespace declaration. Collections
Collection Description behaviorUrns Returns a collection of Uniform Resource Name (URN) strings identifying the behaviors attached to the element. Events
Event Event Property Description abort ![]()
onabort Fires when the user aborts the download. change ![]()
onchange Fires when the contents of the object or selection have changed. error onerror Fires when an error occurs during object loading. input ![]()
oninput Occurs when the text content of an element is changed through the user interface. load onload Fires immediately after the client loads the object. readystatechange onreadystatechange Fires when the state of the object has changed. onreset ![]()
Fires when the user resets a form. select ![]()
onselect Fires when the current selection changes. Methods
Method Description addBehavior Attaches a behavior to the element. applyElement Makes the element either a child or parent of another element. clearAttributes Removes all attributes and values from the object. componentFromPoint Returns the component located at the specified coordinates via certain events. dragDrop Initiates a drag event. getAttributeNodeNS ![]()
Gets an attribute object that matches the specified namespace and name. getAttributeNS ![]()
Gets the value of the specified attribute within the specified namespace. getElementsByClassName ![]()
Gets a collection of objects that are based on the value of the CLASS attribute. getElementsByTagNameNS ![]()
Gets a collection of objects that are based on the specified element names within a specified namespace. hasAttributeNS ![]()
Determines whether an attribute that has the specified namespace and name exists. msMatchesSelector ![]()
Determines whether an object matches the specified selector. removeAttributeNS ![]()
Removes the specified attribute from the object. removeBehavior Detaches a behavior from the element. replaceAdjacentText Replaces the text adjacent to the element. setAttributeNodeNS ![]()
Sets an attribute object as part of the object. setAttributeNS ![]()
Sets the value of the specified attribute within the specified namespace. setCapture Sets the mouse capture to the object that belongs to the current document. Prototypes
Object Description HTMLStyleElement Constructor Defines the properties and methods inherited by objects in the HTMLStyleElement Constructor prototype chain. Styles
Remarks
The STYLE element should appear in the HEAD section of an HTML document. Microsoft Internet Explorer 4.0 and later permit multiple style blocks.
This element is not rendered.
This element requires a closing tag.
Example
This example encloses style declarations in the STYLE element and changes one of those settings using the style object.
<HEAD> <STYLE> BODY { background-color: white; color: black; } H1 { font: 8pt Arial bold; } P { font: 10pt Arial; text-indent: 0.5in; } A { text-decoration: none; color: blue; } </STYLE> <SCRIPT> oParagraph.style.fontSize = 14; </SCRIPT> </HEAD> <BODY> <P>Sample Paragraph Text</P> </BODY>
Standards Information
This object is defined in HTML 3.2.
- 12/29/2011
- Rich Carlson
Only the first of multiple selectors gets parameter updates.
e.g.
In <STYLE id=sayStyle> DL DL DT, DL DL .LOG {margin:0,0,0,-90;text-indent:0}</STYLE>
DL DL DT gets the subsequent 'user-desired' changes to the sayStyle.styleSheet.rules[0].style.marginLeft ...
- 6/21/2010
- Mr. Raymond Kenneth Petry
- 1/4/2010
- Michael Quinlan
