I have a horizontal widget with a variety of feed sources. Some feeds are taller than others, creating a visually jarring effect (+ PageSpeed Insights is dinging me for excessive CLS). In an attempt to create a fixed height equal to the tallest source, I have tried the following:
- Wrapping widget code in
<div="height:398px; max-height:100%">...</div>- did not work. - Setting
height:398pxonBackground__Overlay-scin configurator - did not work. - JavaScript, using
element.style.height = '398px';- did not work.
AI suggested the following, which also did not work:
.global-styles [class="Widget__Container"],
.global-styles [class*="Slider__Item"],
.global-styles [class*="Text__Container"],
.global-styles [class*="Layer__HiddenLayer-sc"] {
height: 398px !important; /* force shorter elements to take up the max height */
min-height: 398px !important; /* 398px = tallest display on desktop */
max-height: 398px !important;
}
.global-styles [class="Text__Container"] {
display: flex !important;
flex-direction: column !important;
justify-content: flex-start !important; /* OPTIONAL: prevent stretching of short text */
}
@media screen and (max-width: 768px) {
.global-styles [class="Widget__Container"],
.global-styles [class*="Slider__Item"],
.global-styles [class*="Text__Container"],
.global-styles [class*="Layer__HiddenLayer-sc"] {
height: auto !important; /* prevent clipping on mobile */
min-height: 450px !important; /* set a new baseline for vertical phone views */
max-height: none !important;
}
}
I would prefer to do this within the configurator while maintaining responsiveness. Ideas?