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

Custom properties can be applied to any element as well. You can constrain the effects of either to only the elements they should affect in your CSS rules.


> Custom properties can be applied to any element as well.

Well, no, they can't. That's the point the article is making.

Classes can compose arbitrarily, i.e. class="size-small size-big"

Whereas data-size="small big", while valid syntax, would not be styled by a rule targeting elem[data-size="small"]




Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

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

Search: