Description
The BackgroundPositionY
property in the Sandbox.UI.BaseStyles
class represents the background-position-y
CSS property. This property is used to set the vertical position of a background image within an element. It accepts a Sandbox.UI.Length
value, which can be a specific length or a percentage, allowing for precise control over the background image's vertical alignment.
Usage
To use the BackgroundPositionY
property, you can assign it a value of type Sandbox.UI.Length
. This can be done directly in your UI component's style settings. The property is nullable, meaning it can be set to null
if you want to remove any specific vertical positioning and revert to the default behavior.
Example
BaseStyles styles = new BaseStyles();
styles.BackgroundPositionY = new Length(50, LengthUnit.Percent); // Centers the background vertically
styles.BackgroundPositionY = new Length(10, LengthUnit.Pixels); // Positions the background 10 pixels from the top
styles.BackgroundPositionY = null; // Resets to default vertical positioning