Javascript Reference
Categories: STYLE

javascript STYLE cssText

@March 15, 2008, 1:22 a.m.
cssTextFirefox/Netscape/NN 6 IE 4 Chrome/Safari/DOM 2  

Read-only  

Returns a string of the entire CSS style sheet rule applied to the element. If the rule included shorthand style attribute settings (such as border), browsers return modified versions according to their ideas of what the value means. If you set the style attribute of an element to style="border: groove red 3px", IE for Windows reports the cssText property for that element as:

BORDER-RIGHT: red 3px groove; BORDER-TOP: red 3px groove; 
BORDER-LEFT: red 3px groove; BORDER-BOTTOM: red 3px groove
 

IE for Macintosh reports:

{BORDER-TOP: 3px groove red; BORDER-RIGHT: 3px groove red; 
BORDER-BOTTOM: 3px groove red; BORDER-LEFT: 3px groove red}
 

And Netscape 6 reports:

border: 3px groove red;
 

Note how each browser manipulates the sequence of individual values. Even so, you can assign a shorthand value to the property and in any order you like. Available in IE as a property of the style and runtimeStyle objects only.

 
Example
 
document.getElementById("block3").style.cssText = "margin: 2px; font-size: 14pt";
 
Value

String value of semicolon-delimited style attributes.

 
Default

None.

Under moderation.
LarryLom - 1 weeks
Under moderation.
Barbarafes - 1 weeks
Under moderation.
LarryLom - 1 weeks

Powered by Linode.