CSS Equivalent of the “if” statement

前端 未结 12 1375
暖寄归人
暖寄归人 2020-12-01 13:49

Is there any way to use conditional statements in CSS?

12条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-01 14:48

    The only conditions available in CSS are selectors and @media. Some browsers support some of the CSS 3 selectors and media queries.

    You can modify an element with JavaScript to change if it matches a selector or not (e.g. by adding a new class).

提交回复
热议问题