Class PercentageValue

All Implemented Interfaces:
CSSPrimitiveValue2, ExtendedCSSPrimitiveValue, ExtendedCSSValue, Cloneable, CSSPrimitiveValue, CSSValue

public class PercentageValue extends NumberValue
Percentage CSSPrimitiveValue.
  • Method Details

    • getFloatValue

      public float getFloatValue(short unitType) throws DOMException
      Gets 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.
      Specified by:
      getFloatValue in interface CSSPrimitiveValue
      Overrides:
      getFloatValue in class NumberValue
      Parameters:
      unitType - A unit code to get the float value. The unit code can only be CSS_NUMBER or CSS_PERCENTAGE.
      Returns:
      The float value in the specified unit.
      Throws:
      DOMException - INVALID_ACCESS_ERR if the CSS value doesn't contain a float value or if the float value can't be converted into the specified unit.