Package com.oorian.css.units
Class Em
java.lang.Object
com.oorian.css.units.Units
com.oorian.css.units.Em
CSS em unit value.
The em unit is relative to the font-size of the element. If the element has a font-size of 16px, then 1em equals 16px, 2em equals 32px, etc. Em units are particularly useful for creating scalable layouts that adapt to font size changes.
Usage:
Units size = new Em(1.5f);
element.setPadding(new Em(1));
element.setMargin(new Em(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 em value.
-
Constructor Details
-
Em
public Em(float value) Constructs an Em unit with the specified value.- Parameters:
value- the em value
-
-
Method Details
-
sizeToString
Returns the CSS string representation of this em value.- Specified by:
sizeToStringin classUnits- Returns:
- the CSS value string (e.g., "1.5em")
-