Aspect Ratio
Maintain a specific ratio between width and height.
The aspectRatio property sets a preferred ratio for the item's dimensions. If one dimension is set (e.g., width) and the other is auto (height), Taffy will calculate the missing dimension to satisfy the ratio.
Usage
Pass a single number representing the ratio width / height.
1.0= Square (1:1)1.5= Landscape (3:2)1.77≈ 16:90.56≈ 9:16
Example
Loading Preview…