STYLE Element | style Object
| |
Specifies a style sheet for the page.
Members Table
The following table lists the members exposed by the
style
object. Click a tab on the left to choose the type of member you want to view.
Attributes/Properties
| Attribute | Property | Description |
|---|
| disabled |
Sets or retrieves whether a style sheet is applied to the object. |
| ID | id |
Retrieves the string identifying the object. |
| innerHTML |
Retrieves the HTML between the start and end tags of the object. |
Collections
| Collection | Description |
|---|
| behaviorUrns |
Returns a collection of Uniform Resource Name (URN) strings identifying the behaviors attached to the element. |
Events
| Event | Description |
|---|
| onerror |
Fires when an error occurs during object loading. |
| onreadystatechange |
Fires when the state of the object has changed. |
Methods
| Method | Description |
|---|
| addBehavior |
Attaches a behavior to the element. |
| dragDrop |
Initiates a drag event. |
| removeBehavior |
Detaches a behavior from the element. |
| removeNode |
Removes the object from the document hierarchy. |
Styles
| Style attribute | Style property | Description |
|---|
| MEDIA | media |
Sets or retrieves the media type. |
| TYPE | type |
Retrieves the Cascading Style Sheets (CSS) language in which the style sheet is written. |
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 available in HTML as of Internet Explorer 3.0, and in script as of Internet Explorer 4.0.
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
object is defined in
HTML 3.2
.