Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You can already do things like this with stylus (http://learnboost.github.com/stylus/). As far as I can see, if you are thinking at this level with css you should be using a preprocessor for sure. I can't remember the last project I used vanilla css in.

Here's a totally silly example, but you can see the power:

    color-if-hidden(color)
      if @display == none
        color: color

    .hello
      display: none
      color-if-hidden(red)


It's true, but you're not considering cascade rules, of course. How do you know that another selector has `display: inline`ed that element?

EDIT: typo




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

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

Search: