TOC PREV NEXT INDEX

domref



style


style returns the block of style rules on the current element.

Syntax

styleBlock = element.style 
 
( element.style.styleAttr = value )
 

Parameters

styleBlock is a string containing the

Example

div = document.getElementById("div1);
 
div.style.marginTop = ".25in";
 

Notes

style is a very commonly used property in DOM programming. You can use it to get the style rules associated with a particular element, and though you cannot set style on an element by assigning to the style property directly, you can use the style property to get to the writable style attributes on the node, as in the short example above.

See the DOM CSS Properties List for a list of the CSS properties that are accessible from the Gecko DOM. There are some additional notes there about the use of the style property to style elements in the DOM.

Specification

style
 


Netscape Communications
http://developer.netscape.com
TOC PREV NEXT INDEX