Package com.oorian.css.units
Class Vw
java.lang.Object
com.oorian.css.units.Units
com.oorian.css.units.Vw
CSS vw (viewport width) unit value.
The vw unit is equal to 1% of the width of the viewport. For example, if the viewport is 1200px wide, 1vw equals 12px. Viewport units are useful for creating responsive layouts that scale proportionally with the viewport size.
Usage:
Units size = new Vw(100); // Full viewport width
element.setWidth(new Vw(50)); // Half viewport width
element.setFontSize(new Vw(2));
- 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 vw value.
-
Constructor Details
-
Vw
public Vw(float value) Constructs a Vw unit with the specified value.- Parameters:
value- the vw value (percentage of viewport width)
-
-
Method Details
-
sizeToString
Returns the CSS string representation of this vw value.- Specified by:
sizeToStringin classUnits- Returns:
- the CSS value string (e.g., "50vw")
-