This object is available to unprivileged JavaScript. It implements the following interfaces:


String azimuth

String background

String backgroundAttachment

String backgroundColor

String backgroundImage

String backgroundPosition

String backgroundRepeat

String border

String borderBottom

String borderBottomColor

String borderBottomStyle

String borderBottomWidth

String borderCollapse

String borderColor

String borderLeft

String borderLeftColor

String borderLeftStyle

String borderLeftWidth

String borderRight

String borderRightColor

String borderRightStyle

String borderRightWidth

String borderSpacing

String borderStyle

String borderTop

String borderTopColor

String borderTopStyle

String borderTopWidth

String borderWidth

String bottom

String captionSide

String clear

String clip

String color

String content

String counterIncrement

String counterReset

String cssFloat

String cssText

The nsIDOMCSSStyleDeclaration interface is a datatype for a CSS style declaration in the Document Object Model.

For more information on this interface please see http://www.w3.org/TR/DOM-Level-2-Style

String cue

String cueAfter

String cueBefore

String cursor

String direction

String display

String elevation

String emptyCells

String font

String fontFamily

String fontSize

String fontSizeAdjust

String fontStretch

String fontStyle

String fontVariant

String fontWeight

String height

String left

readonly int length

String letterSpacing

String lineHeight

String listStyle

String listStyleImage

String listStylePosition

String listStyleType

String margin

String marginBottom

String marginLeft

String marginRight

String marginTop

String markerOffset

String marks

String maxHeight

String maxWidth

String minHeight

String minWidth

String MozAppearance

String MozBackgroundClip

String MozBackgroundInlinePolicy

String MozBackgroundOrigin

String MozBinding

String MozBorderBottomColors

String MozBorderLeftColors

String MozBorderRadius

String MozBorderRadiusBottomleft

String MozBorderRadiusBottomright

String MozBorderRadiusTopleft

String MozBorderRadiusTopright

String MozBorderRightColors

String MozBorderTopColors

String MozBoxAlign

String MozBoxDirection

String MozBoxFlex

String MozBoxOrdinalGroup

String MozBoxOrient

String MozBoxPack

String MozBoxSizing

String MozColumnCount

String MozColumnGap

String MozColumnWidth

String MozFloatEdge

String MozForceBrokenImageIcon

String MozImageRegion

String MozMarginEnd

String MozMarginStart

String MozOpacity

String MozOutline

String MozOutlineColor

String MozOutlineOffset

String MozOutlineRadius

String MozOutlineRadiusBottomleft

String MozOutlineRadiusBottomright

String MozOutlineRadiusTopleft

String MozOutlineRadiusTopright

String MozOutlineStyle

String MozOutlineWidth

String MozPaddingEnd

String MozPaddingStart

String MozUserFocus

String MozUserInput

String MozUserModify

String MozUserSelect

String opacity

String orphans

String outline

String outlineColor

String outlineOffset

String outlineStyle

String outlineWidth

String overflow

String overflowX

String overflowY

String padding

String paddingBottom

String paddingLeft

String paddingRight

String paddingTop

String page

String pageBreakAfter

String pageBreakBefore

String pageBreakInside

readonly CSSRule parentRule

String pause

String pauseAfter

String pauseBefore

String pitch

String pitchRange

String position

String quotes

String richness

String right

String size

String speak

String speakHeader

String speakNumeral

String speakPunctuation

String speechRate

String stress

String tableLayout

String textAlign

String textDecoration

String textIndent

String textShadow

String textTransform

String top

String unicodeBidi

String verticalAlign

String visibility

String voiceFamily

String volume

String whiteSpace

String widows

String width

String wordSpacing

String zIndex


CSSValue getPropertyCSSValue ( String propertyName ) String getPropertyPriority ( String propertyName ) String getPropertyValue ( String propertyName ) String item ( int index ) String removeProperty ( String propertyName ) void setProperty ( String propertyName , String value , String priority )

CSSValue getPropertyCSSValue ( String propertyName )


String getPropertyPriority ( String propertyName )


String getPropertyValue ( String propertyName )


String item ( int index )


String removeProperty ( String propertyName )


void setProperty ( String propertyName , String value , String priority )


Reference documentation is generated from Mozilla's source.

Add a note User Contributed Notes
August 18, 2005, 8:26 am subliminal at gmail dot com
setProperty will only allow you to pass in css property names, not the camelCase names returned by getPropertyValue or that are exposed by the CSSStyleDeclaration.

If you want to populate a fresh element with the style of another one, you need to explicitly set those values like this, perhaps...

clone = document.createElement(node.tagName)
ns = document.defaultView.getComputedStyle(node,'')

for(var name in ns){
value = ns[name]
if(value != "" && !(value instanceof Object) && name != "length" && name !="parentRule"){
* clone.style.setProperty(name,value,'')
* will not work because name is camelCased
* so only the line below will work in this way.
clone.style[name] = value
April 24, 2005, 9:18 am atrus at atrus dot org
Two notes about
* The propertyName is the CSS name, not the Javascript one
* The priority parameter should be either

For example:
introBy.style.setProperty( "background-position", "0px 1px", "" );
introBy.style.backgroundPosition; // returns "0px 1px"

Copyright © 1999 - 2005 XULPlanet.com