www.fgks.org   »   [go: up one dir, main page]

STYLE Element | style Object

Specifies a style sheet for the page.

Members Table

The following table lists the members exposed by the style object.

Attributes/Properties
AttributePropertyDescription
DISABLEDdisabled Sets or retrieves a value that indicates whether the user can interact with the object.
IDid Retrieves the string identifying the object.
innerHTML Retrieves the HTML between the start and end tags of the object.
Collections
CollectionDescription
behaviorUrns Returns a collection of Uniform Resource Name (URN) strings identifying the behaviors attached to the element.
Events
EventDescription
onerror Fires when an error occurs during object loading.
onreadystatechange Fires when the state of the object has changed.
Methods
MethodDescription
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 attributeStyle propertyDescription
MEDIAmedia Sets or retrieves the media type.
TYPEtype 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 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 World Wide Web link.



MSDN Library
Web Development
HTML and CSS
HTML and DHTML Reference
Objects
style (HTML Element)