CSS calc() function not working due to removal of spaces around operators
Omnis Lux
Registered Users Posts: 8 Big grins
Hi. I am not sure this would be considered a bug or 'by design', but here goes:
I'm in the process of designing my site, and I'm trying to use font scaling on gallery and folder headers. To accomplish this I use the vh and vw units, and I want to use these in conjuction with the calc()-function e.g:
font-size: calc(2vw + 12px);
This works fine in the editor, and the fonts scales as expected (relative to the viewport-size). But as soon as I publish, it stops working. When using the inspector in Chrome, the code shows:
font-size: calc(2vw+12px);
I.e the spaces around the '+' -operator has been removed by SmugMug, and therefore the syntax does not comply with the CSS3 specification (The spaces are neccesary to differentiate between operators and signed numbers). Chrome reports a 'Invalid property value' and ignores the code.
Any clue on how I can circumvent this, and still use calc() with + and - operators...?
I'm in the process of designing my site, and I'm trying to use font scaling on gallery and folder headers. To accomplish this I use the vh and vw units, and I want to use these in conjuction with the calc()-function e.g:
font-size: calc(2vw + 12px);
This works fine in the editor, and the fonts scales as expected (relative to the viewport-size). But as soon as I publish, it stops working. When using the inspector in Chrome, the code shows:
font-size: calc(2vw+12px);
I.e the spaces around the '+' -operator has been removed by SmugMug, and therefore the syntax does not comply with the CSS3 specification (The spaces are neccesary to differentiate between operators and signed numbers). Chrome reports a 'Invalid property value' and ignores the code.
Any clue on how I can circumvent this, and still use calc() with + and - operators...?
0
Comments
font-size: calc(2vw - -12px)
Former SmugMug Product Team
aaron AT aaronmphotography DOT com
Website: http://www.aaronmphotography.com
My SmugMug CSS Customizations website: http://www.aaronmphotography.com/Customizations
Any chances of SmugMug stops removing white-spaces in CSS content-blocks, or at least inside of calc() parentheses...?
I'll double check with Engineering on the double-negative, since it was their suggestion. While I'd love to have a quick solution for you, it looks like using the theme site-wide CSS may be your best bet going forward.
Former SmugMug Product Team
aaron AT aaronmphotography DOT com
Website: http://www.aaronmphotography.com
My SmugMug CSS Customizations website: http://www.aaronmphotography.com/Customizations
I had one of our QA folks give this a whirl and it looks like the double negative should work. Here's an example using the double negative.
Using this code in a "CSS Content Block":
Former SmugMug Product Team
aaron AT aaronmphotography DOT com
Website: http://www.aaronmphotography.com
My SmugMug CSS Customizations website: http://www.aaronmphotography.com/Customizations
I got i t to work - I had mistyped it ( {font-size: calc(2vw - - 12px);} )
Now it comes out correct, with spaces around the operator. Thank you so much for your time, leftquark!