Package com.oorian.css.units
Class Cm
java.lang.Object
com.oorian.css.units.Units
com.oorian.css.units.Cm
CSS cm (centimeter) unit value.
The cm unit is an absolute-length unit equal to one centimeter. In CSS, 1cm equals 96px/2.54 (approximately 37.8px). Centimeters are primarily useful for print stylesheets where physical measurements are important.
Usage:
Units size = new Cm(5);
element.setWidth(new Cm(10));
element.setMargin(new Cm(2.5f));
- Since:
- 2016
- Version:
- 1.0
- Author:
- Marvin P. Warble Jr.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the CSS string representation of this cm value.
-
Constructor Details
-
Cm
public Cm(float value) Constructs a Cm unit with the specified value.- Parameters:
value- the centimeter value
-
-
Method Details
-
sizeToString
Returns the CSS string representation of this cm value.- Specified by:
sizeToStringin classUnits- Returns:
- the CSS value string (e.g., "5cm")
-