Class BackgroundPositionHelper
java.lang.Object
dev.jcputney.mjml.util.BackgroundPositionHelper
Normalizes CSS background-position values to "x y" format. Shared by MjSection and MjWrapper.
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanChecks whether the given value is a horizontal (x-axis) position keyword.static booleanChecks whether the given value is a vertical (y-axis) position keyword.static StringNormalizes background position to "x y" format.
-
Method Details
-
normalize
Normalizes background position to "x y" format. Swaps y-x order: "top center" becomes "center top". Single values get "center" appended: "50%" becomes "50% center". Null/empty returns "center top".- Parameters:
pos- the background position string to normalize, may benullor empty- Returns:
- the normalized background position in "x y" format
-
isYValue
Checks whether the given value is a vertical (y-axis) position keyword.- Parameters:
val- the CSS position value to check- Returns:
trueif the value is "top" or "bottom",falseotherwise
-
isXValue
Checks whether the given value is a horizontal (x-axis) position keyword.- Parameters:
val- the CSS position value to check- Returns:
trueif the value is "left", "right", or "center",falseotherwise
-