CSS calc() behaviour in CSS variables
问题 I'm curious to the behaviour of using calc() in setting a CSS variable. Example: #test { --halfWidth: calc(100% / 2); } Now, if the #test element, say a div , was 500px wide, I would like the --halfWidth variable to be set to 250px. But, as far as I can tell the var(--halfWidth) code used elsewhere simply drops in the calc(100% / 2) string instead of 250px . Which means that I can't use the calculation of say element A and use it in element B later on, since it would simply set for example