Jfer00 Posted May 27, 2020 Share Posted May 27, 2020 Hi, I have a custom html list whose items I try to show in three columns with flexbox. List items have padding to add room for item background. li { flex: 0 0 calc(33% - 66px); padding: 0 16px 0 50px; background: url('check.png') no-repeat left top; } The problem is that squarespace has some kind of preprocessor which converts calc() to this: (style copied from browsers inspector) flex: 0 0 calc(-33%); How should I write calc() to keep it in the desired format? Link to comment
tuanphan Posted May 27, 2020 Share Posted May 27, 2020 You can add CSS to Code Injection Header or add to Code Block, I think it will work there. <style> paste css here </style> Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!) Link to comment
Jfer00 Posted May 29, 2020 Author Share Posted May 29, 2020 Thanks tuanphan, it works as there is no preprocessor for code blocks. 🙂 I just would prefer to put all custom code to the same place but if it's not possible I just have to use code blocks. Link to comment
paul2009 Posted May 29, 2020 Share Posted May 29, 2020 @Jfer00 This is because the 'Custom CSS' panel is actually the 'Custom LESS' panel 😁. Any math operations in brackets are calculated first (33-66=-33) and then the CSS parsed. You can avoid this by using escaping it like this: flex: 0 0 calc(~"33% - 66px"); Me: I'm Paul, a SQSP user for >18 yrs & Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥. Work: Founder of SF.DIGITAL. We provide high quality original extensions to supercharge your Squarespace website. Content: Views and opinions are my own. Links in my posts may refer to my own SF.DIGITAL products or may be affiliate links. Forum advice is completely free. You can thank me by selecting a feedback emoji. Buying a coffee is generous but optional. Would you like your customers to be able to mark their favourite products in your Squarespace store? Link to comment
Desigra Posted May 29, 2021 Share Posted May 29, 2021 @paul2009 Works perfectly. 👌 Thank you so much! 🙌 Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.