From 057120a0cb4fa7389c39f0c9d3ed8d75e41ac8e0 Mon Sep 17 00:00:00 2001 From: Mike Wiedenbauer Date: Tue, 2 Dec 2025 16:27:35 +0100 Subject: [PATCH 1/2] Add dynamic viewport width and height unig (dvw/dvh) --- ph-css/src/main/java/com/helger/css/ECSSUnit.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ph-css/src/main/java/com/helger/css/ECSSUnit.java b/ph-css/src/main/java/com/helger/css/ECSSUnit.java index a65d90ac..a1cc184c 100644 --- a/ph-css/src/main/java/com/helger/css/ECSSUnit.java +++ b/ph-css/src/main/java/com/helger/css/ECSSUnit.java @@ -88,6 +88,10 @@ public enum ECSSUnit implements IHasName VMIN ("vmin", ECSSMetaUnit.VIEWPORT_RELATIVE_LENGTH), /** Equal to the larger of 'vw' or 'vh'. */ VMAX ("vmax", ECSSMetaUnit.VIEWPORT_RELATIVE_LENGTH), + /** Equal to 1% of the width of the dynamic viewport. */ + DVW ("dvw", ECSSMetaUnit.VIEWPORT_RELATIVE_LENGTH), + /** Equal to 1% of the height of the dynamic viewport. */ + DVH ("dvh", ECSSMetaUnit.VIEWPORT_RELATIVE_LENGTH), /** Represents a percentage of the width of the query container. */ CQW ("cqw", ECSSMetaUnit.CONTAINER_RELATIVE_LENGTH), From 577305fdd67ad6cbb9741ea13dc8f0fde8f078ad Mon Sep 17 00:00:00 2001 From: Mike Wiedenbauer Date: Tue, 2 Dec 2025 22:22:57 +0100 Subject: [PATCH 2/2] Add formatting methods --- .../main/java/com/helger/css/ECSSUnit.java | 78 +++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/ph-css/src/main/java/com/helger/css/ECSSUnit.java b/ph-css/src/main/java/com/helger/css/ECSSUnit.java index a1cc184c..aa1f52e5 100644 --- a/ph-css/src/main/java/com/helger/css/ECSSUnit.java +++ b/ph-css/src/main/java/com/helger/css/ECSSUnit.java @@ -570,6 +570,84 @@ public static String vmax (@NonNull final BigDecimal aValue) return VMAX.format (aValue); } + /** + * @param nValue + * value to format + * @return value + "dvw" + * @since 8.1.1 + */ + @NonNull + @Nonempty + public static String dvw (final int nValue) + { + return DVW.format (nValue); + } + + /** + * @param dValue + * value to format + * @return value + "dvw" + * @since 8.1.1 + */ + @NonNull + @Nonempty + public static String dvw (final double dValue) + { + return DVW.format (dValue); + } + + /** + * @param aValue + * Value to format. May not be null. + * @return value + "dvw" + * @since 8.1.1 + */ + @NonNull + @Nonempty + public static String dvw (@NonNull final BigDecimal aValue) + { + return DVW.format (aValue); + } + + /** + * @param nValue + * value to format + * @return value + "dvh" + * @since 8.1.1 + */ + @NonNull + @Nonempty + public static String dvh (final int nValue) + { + return DVH.format (nValue); + } + + /** + * @param dValue + * value to format + * @return value + "dvh" + * @since 8.1.1 + */ + @NonNull + @Nonempty + public static String dvh (final double dValue) + { + return DVH.format (dValue); + } + + /** + * @param aValue + * Value to format. May not be null. + * @return value + "dvh" + * @since 8.1.1 + */ + @NonNull + @Nonempty + public static String dvh (@NonNull final BigDecimal aValue) + { + return DVH.format (aValue); + } + /** * @param nValue * value to format