dvgdvgdvg Posted March 23, 2021 Share Posted March 23, 2021 (edited) Site URL: https://cyan-teal-3zmw.squarespace.com/case-study-equality-indicators I'm working on a page with overlapping sections – one is inset with text, and one is full-width behind it as a background color – and I'm trying to get the background section height to expand as the text section on top of it expands. (Screengrab attached.) To achieve this, I'm using the calc function to make the height increase as the screen width decreases. Here's an example: [data-section-id="6027ff54b347b32cf0c31df8"] { @media screen and (min-width: 1125px) and (max-width: 1400px) { min-height: calc(900px - 20vw)!important; } } This works for me when I test it in Inspector, but once it's live, I get this error message from Squarespace when inspecting the live CSS, which states that px + vw are incompatible units: /* WARNING raised evaluating next rule: ExecuteError INCOMPATIBLE_UNITS: No conversion is possible from PX (pixels) to VW (viewport's width).. stripping unit. */ As a result of this, my calc function is being stripped and made static. I've seen plenty of instances of these units being combined though, so I know it's possible. Am I doing something wrong? Anyone have a workaround? (Site password: governance) Edited March 23, 2021 by dvgdvgdvg Beyondspace 1 Link to comment
Solution Beyondspace Posted March 25, 2021 Solution Share Posted March 25, 2021 On 3/23/2021 at 11:19 PM, dvgdvgdvg said: Site URL: https://cyan-teal-3zmw.squarespace.com/case-study-equality-indicators I'm working on a page with overlapping sections – one is inset with text, and one is full-width behind it as a background color – and I'm trying to get the background section height to expand as the text section on top of it expands. (Screengrab attached.) To achieve this, I'm using the calc function to make the height increase as the screen width decreases. Here's an example: [data-section-id="6027ff54b347b32cf0c31df8"] { @media screen and (min-width: 1125px) and (max-width: 1400px) { min-height: calc(900px - 20vw)!important; } } This works for me when I test it in Inspector, but once it's live, I get this error message from Squarespace when inspecting the live CSS, which states that px + vw are incompatible units: /* WARNING raised evaluating next rule: ExecuteError INCOMPATIBLE_UNITS: No conversion is possible from PX (pixels) to VW (viewport's width).. stripping unit. */ As a result of this, my calc function is being stripped and made static. I've seen plenty of instances of these units being combined though, so I know it's possible. Am I doing something wrong? Anyone have a workaround? (Site password: governance) Custom css use less so you can try this syntax width: ~"calc(900px - 20vw)" !important; more info: CSS3 calc() in LESS CSS (Example) (coderwall.com) tuanphan and dvgdvgdvg 1 1 BeyondSpace - Squarespace Website Developer 🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox) 🗓️ Delivery Date Picker (Squarespace Date format) 💫 Animated Buttons (Referral URL) 🥳 Sparkplugin Customisations Browsers (Browse +100 Spark plugin customisations) 🥳 Elfsight Template Browsers (Browse +1000 Elfsight widget Templates) If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you! Link to comment
dvgdvgdvg Posted March 25, 2021 Author Share Posted March 25, 2021 15 hours ago, bangank36 said: Custom css use less so you can try this syntax width: ~"calc(900px - 20vw)" !important; more info: CSS3 calc() in LESS CSS (Example) (coderwall.com) You're a lifesaver! I thought I was going to have to set like 30 media queries per page haha. Thank you!! Beyondspace 1 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment