Package com.oorian.css.units
Class Ch
java.lang.Object
com.oorian.css.units.Units
com.oorian.css.units.Ch
CSS ch (character) unit value.
The ch unit is equal to the width of the "0" (zero) character in the element's font. This unit is particularly useful for sizing elements based on the number of characters they should contain, especially for monospace fonts.
Usage:
Units size = new Ch(40); // Width for approximately 40 characters
element.setWidth(new Ch(60));
element.setMaxWidth(new Ch(80));
- 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 ch value.
-
Constructor Details
-
Ch
public Ch(float value) Constructs a Ch unit with the specified value.- Parameters:
value- the ch value (width of "0" character)
-
-
Method Details
-
sizeToString
Returns the CSS string representation of this ch value.- Specified by:
sizeToStringin classUnits- Returns:
- the CSS value string (e.g., "40ch")
-