Hacker News new | past | comments | ask | show | jobs | submit login

Fortunately, you can use a pre-processor like SASS for that -- however, calc() allows you to do calculations at runtime which cannot be done in a pre-processor.



We'll be looking into compiling certain Sass calculations that can't be done at compile time, such as "3px + 3%", into uses of calc().


or use any of the various scripting languages (php, python, perl etc) to serve the css. Problem solved. Just do this behind a cgi or similar for development, and then just run it and save the output as a static file for production.

It's not like variables in a plain text string are a hard thing, for goodness sake.


I'm pretty sure anyone here will realise this - it's just that it would be better if it were implemented in the spec, I'm amazed that colour definitions aren't in CSS3.


width: 100% - 2px cannot be done via PHP. That's why this is very interesting. 100% changes depending on your browser window size.


well yes, but I was responding to the following from the GP, rather than discussing the power of calc()

> I rather have vars or defs so I can declare a color once...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: