CSS Selector “(A or B) and C”?

前端 未结 4 1239
时光取名叫无心
时光取名叫无心 2020-11-27 14:24

This should be simple, but I\'m having trouble finding the search terms for it.
Let\'s say I have this:

Foo
4条回答
  •  温柔的废话
    2020-11-27 14:51

    No. Standard CSS does not provide the kind of thing you're looking for.

    However, you might want to look into LESS and SASS.

    These are two projects which aim to extend default CSS syntax by introducing additional features, including variables, nested rules, and other enhancements.

    They allow you to write much more structured CSS code, and either of them will almost certainly solve your particular use case.

    Of course, none of the browsers support their extended syntax (especially since the two projects each have different syntax and features), but what they do is provide a "compiler" which converts your LESS or SASS code into standard CSS, which you can then deploy on your site.

提交回复
热议问题