Description
The BackgroundPositionX
property in the Sandbox.UI.BaseStyles
class represents the background-position-x
CSS property. This property is used to set the horizontal position of a background image within an element. It can be specified using various units such as pixels, percentages, or other length units defined in the Sandbox.UI.Length
type.
Usage
To use the BackgroundPositionX
property, you can assign it a value of type Sandbox.UI.Length
or null
. Setting it to null
will remove any previously set value, effectively resetting the property.
Example
// Example of setting the BackgroundPositionX property
var styles = new BaseStyles();
styles.BackgroundPositionX = new Length(50, LengthUnit.Percent); // Set to 50% of the element's width
// Resetting the BackgroundPositionX property
tyles.BackgroundPositionX = null; // Removes the background position setting