Change Language


Follow Navioo On Twitter

CSSStyleDeclaration : Object

CSS style declaration block consisting of CSS attributes and their values.

Platform Support

IE Mozilla Netscape Opera Safari
no 1.0+ no 9.0+ 1.0+

Constructors

Constructor Action IE Mozilla Netscape Opera Safari
CSSStyleDeclaration Constructor() : CSSStyleDeclaration
CSS style declaration block consisting of CSS attributes and their values.
Show Details no 1.0+ no 9.0+ 1.0+

CSSStyleDeclaration() : CSSStyleDeclaration

CSS style declaration block consisting of CSS attributes and their values.

Returns

CSSStyleDeclaration
Visibility
internal

Properties

Property Action IE Mozilla Netscape Opera Safari
cssText : String
Text for the current CSS rule.
Show Details no 1.0+ no 9.0+ 1.0+

For examples, see the Navioo examples page:

http://www.navioo.com/html_css/CSS_Attributes_and_Javascript_Style_Properties_142.dhtml

Remarks

If you specify an invalid value for cssText, the property may throw one of the following DOMExceptions:

  • HIERARCHY_REQUEST_ERR - CSS rule is not legal in the current location in the CSS style sheet.
  • INVALID_MODIFICATION_ERR - New value for the CSS rule is for a different type than the previous type.
  • NO_MODIFICATION_ALLOWED_ERR - The CSS rule or its parent CSS style sheet is read-only.
  • SYNTAX_ERR - CSS syntax error.
Availability

HTML DOM Level 2|W3C

length : Number
Number of CSS style attributes in the style declaration block.
Show Details no 1.0+ no 9.0+ 1.0+
Availability

HTML DOM Level 2|W3C

parentRule : CSSRule
CSSRule that contains the CSSStyleDeclaration.
Show Details no 1.0+ no 9.0+ 1.0+
Availability

HTML DOM Level 2|W3C

Functions

Method Action IE Mozilla Netscape Opera Safari
static getPropertyCSSValue(String propertyName) : CSSValue
Returns a CSS attribute value as an object.
Show Details no 1.0+ no no no

Parameters

String propertyName Name of the CSS attribute to return the CSS value for.

Returns

CSSValue
Availability

HTML DOM Level 2|W3C

static getPropertyPriority(String propertyName) : String
Returns the priority of a CSS attribute.
Show Details no 1.0+ no 9.0+ 1.0+

Parameters

String propertyName Name of the CSS attribute to return the priority value for.

Returns

String

For examples, see the Navioo examples page:

http://www.navioo.com/html_css/CSS_Attributes_and_Javascript_Style_Properties_142.dhtml

Availability

HTML DOM Level 2|W3C

static getPropertyValue(String propertyName) : String
Returns a CSS attribute value as a string.
Show Details no 1.0+ no 9.0+ 1.0+

Parameters

String propertyName Name of the CSS attribute to return the value for.

Returns

String

For examples, see the Navioo examples page:

http://www.navioo.com/html_css/CSS_Attributes_and_Javascript_Style_Properties_142.dhtml

Availability

HTML DOM Level 2|W3C

static item(Number index) : String
Returns the name of the CSS attribute at the specified position.
Show Details no 1.0+ no 9.0+ 1.0+

Parameters

Number index Position of the CSS attribute to retrieve.

Returns

String

For examples, see the Navioo examples page:

http://www.navioo.com/javascript/dhtml/Node_Operation_978.dhtml

Availability

HTML DOM Level 2|W3C

static removeProperty(String propertyName) : String
Removes the specified CSS attribute from the CSS style declaration block.
Show Details no 1.0+ no 9.0+ 1.0+

Parameters

String propertyName Name of the CSS attribute to delete.

Returns

String

For examples, see the Navioo examples page:

http://www.navioo.com/html_css/CSS_Attributes_and_Javascript_Style_Properties_142.dhtml

Availability

HTML DOM Level 2|W3C

setProperty(String propertyName, String value, String priority) : void
Sets the value for a CSS attribute for a CSS style declaration block.
Show Details no 1.0+ no 9.0+ 1.0+

Parameters

String propertyName Name of the CSS attribute to set.
String value Value for the CSS attribute.
String priority Priority for the CSS attribute. Specify either the string "important" or an empty string.

Returns

void

For examples, see the Navioo examples page:

http://www.navioo.com/html_css/CSS_Attributes_and_Javascript_Style_Properties_142.dhtml

Availability

HTML DOM Level 2|W3C

References

CSS2Properties

Availability

HTML DOM Level 2|W3C

text_javascript Navioo_docs

Ajax Javascript feed

↑ Grab this Headline Animator