CSSPrimitiveValue Class

CSSPrimitiveValue class

The CSSPrimitiveValue interface represents a single CSS value. This interface may be used to determine the value of a specific style property currently set in a block or to set a specific style property explicitly within the block. An instance of this interface might be obtained from the getPropertyCSSValue method of the CSSStyleDeclaration interface. A CSSPrimitiveValue object only occurs in a context of a CSS property.

public abstract class CSSPrimitiveValue : CSSValue

Properties

NameDescription
abstract CSSText { get; set; }A string representation of the current value.
CSSValueType { get; }A code defining the type of the value.
PrimitiveType { get; }The type of the value as defined by the constants specified above.

Methods

NameDescription
override Equals(object)Determines whether the specified Object is equal to this instance.
abstract GetCounterValue()This method is used to get the Counter value. If this CSS value doesn’t contain a counter value, a DOMException is raised. Modification to the corresponding style property can be achieved using the Counter interface.
abstract GetFloatValue(ushort)This method is used to get a float value in a specified unit. If this CSS value doesn’t contain a float value or can’t be converted into the specified unit, a DOMException is raised.
override GetHashCode()Returns a hash code for this instance.
abstract GetIntValue(ushort)This method is used to get an int value in a specified unit. If this CSS value doesn’t contain an int value or can’t be converted into the specified unit, a DOMException is raised.
override GetPlatformType()This method is used to retrieve ECMAScript object Type.
abstract GetRectValue()This method is used to get the Rect value. If this CSS value doesn’t contain a rect value, a DOMException is raised. Modification to the corresponding style property can be achieved using the Rect interface.
abstract GetRGBColorValue()This method is used to get the RGB color. If this CSS value doesn’t contain a RGB color value, a DOMException is raised. Modification to the corresponding style property can be achieved using the RGBColor interface.
abstract GetStringValue()This method is used to get the string value. If the CSS value doesn’t contain a string value, a DOMException is raised.
abstract SetFloatValue(ushort, float)A method to set the float value with a specified unit. If the property attached with this value can not accept the specified unit or the float value, the value will be unchanged and a DOMException will be raised.
abstract SetIntValue(ushort, int)A method to set the int value with a specified unit. If the property attached with this value can not accept the specified unit or the int value, the value will be unchanged and a DOMException will be raised.
abstract SetStringValue(ushort, string)A method to set the string value with the specified unit. If the property attached to this value can’t accept the specified unit or the string value, the value will be unchanged and a DOMException will be raised.
override ToString()Returns a String that represents this instance.

Fields

NameDescription
const CSS_ATTRThe value is a attribute function. The value can be obtained by using the getStringValue method.
const CSS_CHThe value is a length (ch). The value can be obtained by using the getFloatValue method.
const CSS_CMThe value is a length (cm). The value can be obtained by using the getFloatValue method.
const CSS_COUNTERThe value is a counter or counters function. The value can be obtained by using the GetCounterValue method.
const CSS_DEGThe value is an angle (deg). The value can be obtained by using the getFloatValue method.
const CSS_DIMENSIONThe value is a number with an unknown dimension. The value can be obtained by using the getFloatValue method.
const CSS_DPCMThe value is a dots per centimeter (dpcm).
const CSS_DPIThe value is a dots per inch (dpi).
const CSS_DPPXThe value is a dots per ‘px’ unit (dppx).
const CSS_EMSThe value is a length (ems). The value can be obtained by using the getFloatValue method.
const CSS_EXSThe value is a length (exs). The value can be obtained by using the getFloatValue method.
const CSS_GRADThe value is an angle (grad). The value can be obtained by using the getFloatValue method.
const CSS_HZThe value is a frequency (Hz). The value can be obtained by using the getFloatValue method.
const CSS_IDENTThe value is an identifier. The value can be obtained by using the getStringValue method.
const CSS_INThe value is a length (in). The value can be obtained by using the getFloatValue method.
const CSS_KHZThe value is a frequency (kHz). The value can be obtained by using the getFloatValue method.
const CSS_MMThe value is a length (mm). The value can be obtained by using the getFloatValue method.
const CSS_MSThe value is a time (ms). The value can be obtained by using the getFloatValue method.
const CSS_NUMBERThe value is a simple number. The value can be obtained by using the getFloatValue method.
const CSS_PCThe value is a length (pc). The value can be obtained by using the getFloatValue method.
const CSS_PERCENTAGEThe value is a percentage. The value can be obtained by using the getFloatValue method.
const CSS_PTThe value is a length (pt). The value can be obtained by using the getFloatValue method.
const CSS_PXThe value is a length (px). The value can be obtained by using the getFloatValue method.
const CSS_RADThe value is an angle (rad). The value can be obtained by using the getFloatValue method.
const CSS_RECTThe value is a rect function. The value can be obtained by using the GetRectValue method.
const CSS_REMThe value is a length (rem). The value can be obtained by using the getFloatValue method.
const CSS_RGBCOLORThe value is a RGB color. The value can be obtained by using the GetRGBColorValue method.
const CSS_SThe value is a time (s). The value can be obtained by using the getFloatValue method.
const CSS_STRINGThe value is a STRING. The value can be obtained by using the getStringValue method.
const CSS_UNKNOWNThe value is not a recognized CSS2 value. The value can only be obtained by using the cssText attribute.
const CSS_URIThe value is a URI. The value can be obtained by using the getStringValue method.
const CSS_VHThe value is a percentage of the full viewport height.
const CSS_VMAXThe value is a percentage of the viewport width or height, whichever is larger.
const CSS_VMINThe value is a percentage of the viewport width or height, whichever is smaller.
const CSS_VWThe value is a percentage of the full viewport width.

See Also