The CSSStyleDeclaration
interface represents an object that is a CSS declaration block, and exposes style information and various style-related methods and properties.
Mozilla Firefox is a feature-rich and highly customizable web browser that’s user-friendly enough for beginners and sophisticated enough for advanced users. Cns menu. Firefox has managed to retain significant market share despite stiff competition from Google Chrome and Microsoft Internet Explorer and Edge. Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation. Portions of this content are ©1998–2021 by individual mozilla.org contributors. Content available under. Download Mozilla Firefox, a free web browser. Firefox is created by a global not-for-profit dedicated to putting individuals in control online. Get Firefox for Windows, macOS, Linux, Android and iOS today!
A CSSStyleDeclaration
object can be exposed using three different APIs:
- Via
ElementCSSInlineStyle.style
, which deals with the inline styles of a single element (e.g.,<div>
). - Via the
CSSStyleSheet
API. For example,document.styleSheets[0].cssRules[0].style
returns aCSSStyleDeclaration
object on the first CSS rule in the document's first stylesheet. - Via
Window.getComputedStyle()
, which exposes theCSSStyleDeclaration
object as a read-only interface.
Attributes
CSSStyleDeclaration.cssText
- Textual representation of the declaration block. Setting this attribute changes the style.
CSSStyleDeclaration.length
Read only- The number of properties. See the
item()
method below. CSSStyleDeclaration.parentRule
Read only- The containing
CSSRule
.
CSS Properties
CSSStyleDeclaration.cssFloat
- Special alias for the
float
CSS property. CSSStyleDeclaration
named properties- Dashed and camel-cased attributes for all supported CSS properties.
Methods
Mozilla Explorer Chrome
CSSStyleDeclaration.getPropertyPriority()
- Returns the optional priority, 'important'.
CSSStyleDeclaration.getPropertyValue()
- Returns the property value given a property name.
CSSStyleDeclaration.item()
- Returns a CSS property name by its index, or the empty string if the index is out-of-bounds.
- An alternative to accessing
nodeList[i]
(which instead returnsundefined
wheni
is out-of-bounds). This is mostly useful for non-JavaScript DOM implementations. CSSStyleDeclaration.removeProperty()
- Removes a property from the CSS declaration block.
CSSStyleDeclaration.setProperty()
- Modifies an existing CSS property or creates a new CSS property in the declaration block.
CSSStyleDeclaration.getPropertyCSSValue()
- Only supported via getComputedStyle in Firefox. Returns the property value as a
CSSPrimitiveValue
ornull
for shorthand properties.
Example
Specifications
Specification | Status | Comment |
---|---|---|
CSS Object Model (CSSOM) The definition of 'CSSStyleDeclaration' in that specification. | Working Draft | Merged the DOM Level 2 StyleCSS2Properties interface into CSSStyleDeclaration . |
Document Object Model (DOM) Level 2 Style Specification The definition of 'CSSStyleDeclaration' in that specification. | Obsolete | Initial definition |
Browser compatibility
BCD tables only load in the browser
See also
The HTML <figcaption>
or Figure Caption element represents a caption or legend describing the rest of the contents of its parent <figure>
element.
Content categories | None. |
---|---|
Permitted content | Flow content. |
Tag omission | None, both the starting and ending tag are mandatory. |
Permitted parents | A <figure> element; the <figcaption> element must be its first or last child. |
Implicit ARIA role | No corresponding role |
Permitted ARIA roles | group , none , presentation |
DOM interface | HTMLElement |
Attributes
Examples
Please see the <figure>
page for examples on <figcaption>
.
Specifications
Mozilla Explorer 8 Free Download
Specification | Status | Comment |
---|---|---|
HTML Living Standard The definition of '<figcaption>' in that specification. | Living Standard | |
HTML5 The definition of '<figcaption>' in that specification. | Recommendation |
Mozilla Explorer
Browser compatibility
BCD tables only load in the browser
See also
Mozilla Keyword Explorer
- The
<figure>
element.