Interface CSSUnit


public interface CSSUnit
CSS numeric units.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final short
    Font-relative length (cap).
    static final short
    Font-relative length (ch).
    static final short
    Length (cm).
    static final short
    Angle (deg).
    static final short
    Resolution (dpcm).
    static final short
    Resolution (dpi).
    static final short
    Resolution (dppx).
    static final short
    Font-relative length (em).
    static final short
    Font-relative length (ex).
    static final short
    Flexible length (fr).
    static final short
    Angle (grad).
    static final short
    Frequency (Hz).
    static final short
    Font-relative length (ic).
    static final short
    Length (in).
    static final short
    Invalid CSS unit.
    static final short
    Frequency (kHz).
    static final short
    Font-relative length (lh).
    static final short
    Length (mm).
    static final short
    Time (ms).
    static final short
    Dimensionless number.
    static final short
    Number with an unknown dimension.
    static final short
    Length (pc).
    static final short
    Percentage.
    static final short
    Length (pt).
    static final short
    Length (px).
    static final short
    Length (Q).
    static final short
    Angle (rad).
    static final short
    Font-relative length (rem).
    static final short
    Font-relative length (rlh).
    static final short
    Time (s).
    static final short
    Angle (turn).
    static final short
    Viewport-percentage length (vb).
    static final short
    Viewport-percentage length (vh).
    static final short
    Viewport-percentage length (vi).
    static final short
    Viewport-percentage length (vmax).
    static final short
    Viewport-percentage length (vmin).
    static final short
    Viewport-percentage length (vw).
  • Method Summary

    Static Methods
    Modifier and Type
    Method
    Description
    static String
    dimensionUnitString(short unitType)
    Gives the dimension unit string associated to the given CSS unit type.
    static boolean
    isAngleUnitType(short unitType)
    Check whether the given unit is an angle.
    static boolean
    isLengthUnitType(short unitType)
    Check whether the given unit is a length.
    static boolean
    isRelativeLengthUnitType(short unitType)
    Check whether the given unit is a relative length.
    static boolean
    isResolutionUnitType(short unitType)
    Check whether the given unit is a resolution unit.
    static boolean
    isTimeUnitType(short unitType)
    Check whether the given unit is a time.
  • Field Details

  • Method Details

    • isLengthUnitType

      static boolean isLengthUnitType(short unitType)
      Check whether the given unit is a length.

      Percentage is not considered an explicit length.

      Parameters:
      unitType - the unit type.
      Returns:
      true if the unit is a length.
    • isRelativeLengthUnitType

      static boolean isRelativeLengthUnitType(short unitType)
      Check whether the given unit is a relative length.
      Parameters:
      unitType - the unit type.
      Returns:
      true if the unit is a relative length.
    • isAngleUnitType

      static boolean isAngleUnitType(short unitType)
      Check whether the given unit is an angle.
      Parameters:
      unitType - the unit type.
      Returns:
      true if the unit is an angle.
    • isTimeUnitType

      static boolean isTimeUnitType(short unitType)
      Check whether the given unit is a time.
      Parameters:
      unitType - the unit type.
      Returns:
      true if the unit is a time.
    • isResolutionUnitType

      static boolean isResolutionUnitType(short unitType)
      Check whether the given unit is a resolution unit.
      Parameters:
      unitType - the unit type.
      Returns:
      true if the unit is a resolution unit.
    • dimensionUnitString

      static String dimensionUnitString(short unitType) throws DOMException
      Gives the dimension unit string associated to the given CSS unit type.
      Parameters:
      unitType - the CSS primitive unit type.
      Returns:
      the unit string.
      Throws:
      DOMException - INVALID_ACCESS_ERR if the unit is not a CSSUnit one.