Class Vmax

java.lang.Object
com.oorian.css.units.Units
com.oorian.css.units.Vmax

public class Vmax extends Units
CSS vmax (viewport maximum) unit value.

The vmax unit is equal to 1% of the larger dimension of the viewport (either width or height). For example, if the viewport is 1200px wide and 900px tall, 1vmax equals 12px (1% of 1200). This unit is useful for creating elements that scale with the largest viewport dimension.

Usage:


 Units size = new Vmax(10);
 element.setFontSize(new Vmax(5));
 element.setMaxWidth(new Vmax(80));
 
Since:
2016
Version:
1.0
Author:
Marvin P. Warble Jr.
See Also:
  • Constructor Details

    • Vmax

      public Vmax(float value)
      Constructs a Vmax unit with the specified value.
      Parameters:
      value - the vmax value (percentage of larger viewport dimension)
  • Method Details

    • sizeToString

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