Utility with Duplicate / Fallback Properties #6844
-
Hello there 👋🏼 I'm working on an application that uses Of course, not every browser understands @layer utilities {
.h-available {
height: 100%;
height: 100vh;
height: -webkit-fill-available;
}
} Unfortunately, due to the collapsing of duplicate properties, the output utility has only the last value: .h-available {
height: -webkit-fill-available;
} This is a valuable optimization in general, but it nullifies the fallback behavior I was hoping for. So, is there a more idiomatic approach to accomplishing this behavior? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
As a workaround, I'm using the following: @layer utilities {
.h-available, .override-shim-1 {
height: 100%;
}
.h-available, .override-shim-2 {
height: 100vh;
}
.h-available {
height: 100%;
height: 100vh;
height: -webkit-fill-available;
}
} This creates the desired behavior, cascading along separate rules rather than duplicated properties. However, it is non-obvious for someone who might come along later. |
Beta Was this translation helpful? Give feedback.
-
You can try to use |
Beta Was this translation helpful? Give feedback.
-
Good catch, we shouldn't dedupe properties that could be fallbacks, will fix that 👍🏻 For your specific scenario, you might want to look at this PostCSS plugin: https://github.com/postcss/postcss-100vh-fix |
Beta Was this translation helpful? Give feedback.
Good catch, we shouldn't dedupe properties that could be fallbacks, will fix that 👍🏻
For your specific scenario, you might want to look at this PostCSS plugin:
https://github.com/postcss/postcss-100vh-fix