You are here: Reference > JavaScript > client-side > style handling > methods

Style handling methods in JavaScript

Computed style:

Method Support Description
getComputedStyle
(window)
9
Returns a CSSStyleDeclaration object that represents the computed style for the current element.

Style sheets and rules:

Method Support Description
addImport
(styleSheet)
Imports an external style file into the current styleSheet object.
addPageRule
(styleSheet)
Adds a new page rule to the current styleSheet object.
addRule
(styleSheet)
Inserts a new rule into the current styleSheet object.
appendMedium
(mediaList)
9
Adds a media type to the mediaList collection.
createStyleSheet
(document)
Creates a styleSheet object and inserts it into the current document.
deleteMedium
(mediaList)
9
Removes a media type from the mediaList collection.
deleteRule
(CSSMediaRule, styleSheet)
9
Removes a rule from the current style sheet.
insertRule
(CSSMediaRule, styleSheet)
9
Inserts a new rule into the current style sheet.
removeImport
(styleSheet)
Removes an imported style file from the imports collection of the current styleSheet object.
removeRule
(styleSheet)
Removes a rule from the current styleSheet object.

General methods:

Method Support Description
addBehavior
Attaches the specified behavior to the current element.
getCounterValue
(CSSPrimitiveValue)
If the value represented by the current CSSPrimitiveValue object is a counter function, then retrieves a Counter object that represents the value.
getAttribute
Returns the value of the specified style property.
getExpression
(runtimeStyle, style)
9
Returns the dynamic expression for the specified style property.
getFloatValue
(CSSPrimitiveValue)
If the value represented by the current CSSPrimitiveValue object is a number, then retrieves the value in the specified unit type.
getPropertyCSSValue
Retrieves an object that represents the value of the specified style property.
getPropertyPriority
9
Retrieves the priority of specified style property (the 'important' qualifier).
getPropertyValue
9
Returns the value of the specified style property.
getRectValue
(CSSPrimitiveValue)
If the value represented by the current CSSPrimitiveValue object is a rect function, then retrieves a CSSPrimitiveValue object that represents the value.
getRGBColorValue
(CSSPrimitiveValue)
If the value represented by the current CSSPrimitiveValue object is a color, then retrieves an RGBColor object that represents the value.
getStringValue
(CSSPrimitiveValue)
If the value represented by the current CSSPrimitiveValue object is a string, then retrieves it.
removeAttribute
(runtimeStyle, style)
Removes the specified property from the current style object.
removeExpression
(runtimeStyle, style)
9
Removes the dynamic expression from the specified style property.
removeProperty
9
Removes the specified property from the current style object.
setAttribute
(runtimeStyle, style)
Adds a property with the specified name and value to the current style object.
setExpression
(runtimeStyle, style)
9
Sets a dynamic expression for the specified style property.
setFloatValue
(CSSPrimitiveValue)
Specifies a float value for the CSSPrimitiveValue object with the specified unit type.
setProperty
9
Adds a property with the specified name and value to the current style object.
setStringValue
(CSSPrimitiveValue)
Specifies a string value for the CSSPrimitiveValue object with the specified type.
urns
(all, anchors, areas, ...)
Returns a NodeList collection that contains all elements to which the specified behavior is attached.
User Contributed Comments

Post Content

Post Content