Class Rem


public class Rem extends Units
CSS rem (root em) unit value.

The rem unit is relative to the font-size of the root element (typically the <html> element). Unlike em units, rem units are not affected by the font-size of parent elements, making them more predictable for consistent sizing throughout a document.

Usage:


 Units size = new Rem(1.5f);
 element.setFontSize(new Rem(1));
 element.setPadding(new Rem(2));
 
Since:
2016
Version:
1.0
Author:
Marvin P. Warble Jr.
See Also:
  • Constructor Details

    • Rem

      public Rem(float value)
      Constructs a Rem unit with the specified value.
      Parameters:
      value - the rem value
  • Method Details

    • sizeToString

      public String sizeToString()
      Returns the CSS string representation of this rem value.
      Specified by:
      sizeToString in class Units
      Returns:
      the CSS value string (e.g., "1.5rem")