CssUnitValue Class

A value with a single unit, a number or a percentage (https://drafts.css-houdini.org/css-typed-om-1/#cssunitvalue), e.g. 42px (the unit is "px"), 10 (the unit is "number") or 50% (the unit is "percent").

public sealed class CssUnitValue : CssNumericValue
Inheritance
CssNumericValue CssUnitValue

Constructors

NameDescription
CssUnitValue(double, string)https://drafts.css-houdini.org/css-typed-om-1/#dom-cssunitvalue-cssunitvalue

CssUnitValue(double, string)

CssNumericValue.cs

https://drafts.css-houdini.org/css-typed-om-1/#dom-cssunitvalue-cssunitvalue

public CssUnitValue(double value, string unit)

Properties

NameDescription
UnitThe unit: "number", "percent" or the unit of a dimension (ASCII lowercase, e.g. "px", "q", "hz").
ValueGets or sets the numeric value, without its unit.

The unit: "number", "percent" or the unit of a dimension (ASCII lowercase, e.g. "px", "q", "hz").

public string Unit { get; }

Gets or sets the numeric value, without its unit.

public double Value { get; set; }

Methods

NameDescription
ToString()https://drafts.css-houdini.org/css-typed-om-1/#cssunitvalue-serialization

https://drafts.css-houdini.org/css-typed-om-1/#cssunitvalue-serialization

public override string ToString()

Returns

string