Package com.oorian.css.units
Class Percent
java.lang.Object
com.oorian.css.units.Units
com.oorian.css.units.Percent
CSS percent (%) unit value.
The percent unit is a relative-length unit that represents a percentage of another value, typically the parent element's corresponding property. For example, width: 50% means 50% of the parent element's width. Percentages are fundamental for creating responsive, flexible layouts.
Usage:
Units size = new Percent(50);
element.setWidth(new Percent(100));
element.setPadding(new Percent(10));
- 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 percent value.
-
Constructor Details
-
Percent
public Percent(int value) Constructs a Percent unit with the specified value.- Parameters:
value- the percent value (0-100 or beyond)
-
-
Method Details
-
sizeToString
Returns the CSS string representation of this percent value.- Specified by:
sizeToStringin classUnits- Returns:
- the CSS value string (e.g., "50%")
-