System.Nullable<float> AspectRatio { get; set; }

robot_2Generated
code_blocksInput

Description

Represents the aspect-ratio CSS property.

Usage

The AspectRatio property is used to define the aspect ratio of an element. It is a nullable float, meaning it can be set to a specific ratio or left unset (null). When set, it maintains the specified width-to-height ratio of the element.

Example

// Example of setting the AspectRatio property
BaseStyles styles = new BaseStyles();
styles.AspectRatio = 16f / 9f; // Sets the aspect ratio to 16:9

// Example of clearing the AspectRatio property
styles.AspectRatio = null; // Removes the aspect ratio constraint