Skip to main content

CSSStyleDeclarationBase

The CSSStyleDeclaration interface is the base class for objects that represent CSS declaration blocks with different supported sets of CSS style information:

MDN Reference

Extended by

Indexable

[index: number]: string

Methods

getPropertyPriority()

getPropertyPriority(property): string;

The CSSStyleDeclaration.getPropertyPriority() method interface returns a string that provides all explicitly set priorities on the CSS property.

MDN Reference

Parameters

ParameterType
propertystring

Returns

string


getPropertyValue()

getPropertyValue(property): string;

The CSSStyleDeclaration.getPropertyValue() method interface returns a string containing the value of a specified CSS property.

MDN Reference

Parameters

ParameterType
propertystring

Returns

string


item()

item(index): string;

The CSSStyleDeclaration.item() method interface returns a CSS property name from a CSSStyleDeclaration by index.

MDN Reference

Parameters

ParameterType
indexnumber

Returns

string


removeProperty()

removeProperty(property): string;

The CSSStyleDeclaration.removeProperty() method interface removes a property from a CSS style declaration object.

MDN Reference

Parameters

ParameterType
propertystring

Returns

string


setProperty()

setProperty(
property,
value,
priority?
): void;

The CSSStyleDeclaration.setProperty() method interface sets a new value for a property on a CSS style declaration object.

MDN Reference

Parameters

ParameterType
propertystring
valuestring | null
priority?string

Returns

void

Properties

cssText

cssText: string;

The cssText property of the CSSStyleDeclaration interface returns or sets the text of the element's inline style declaration only.

MDN Reference


length

readonly length: number;

The read-only property returns an integer that represents the number of style declarations in this CSS declaration block.

MDN Reference


parentRule

readonly parentRule: CSSRule | null;

The CSSStyleDeclaration.parentRule read-only property returns a CSSRule that is the parent of this style block, e.g., a CSSStyleRule representing the style for a CSS selector.

MDN Reference