Which browsers still support CSS expressions

前端 未结 3 917
情话喂你
情话喂你 2021-01-18 11:52

From a blog:

The basic idea with CSS expressions is that you will have calculation and dynamic values for properties in the CSS code, something

3条回答
  •  春和景丽
    2021-01-18 12:07

    AFAIK, it was only ever IE6/7 (maybe) 5.

    I never thought they were a good thing. May as well just use JavaScript directly.

    They are in fact implemented in JavaScript, and I'm pretty sure disabling JS disables these expressions.

    The sample you posted...

    width: expression(document.body.clientWidth >  1100)? "1100px" : "auto";
    

    ...is just a ternary operator that says If the width is larger than 1100px, set it 1100px, otherwise set property to auto.

    To finish, no scripting language on the web is more widely supported than JavaScript.

提交回复
热议问题