Using CSS Expressions are good or bad?

2019-08-11 07:26发布

I need some clarifiction on applying expressions in css. Some are suggesting don't go for using css expressions. Please clarify my doubt. thanks

2条回答
唯我独甜
2楼-- · 2019-08-11 08:11

You should not use CSS expressions since they are constantly evaluated on many user interactions across the web page.

Also, Microsoft as deprecated this feature due to this type of complications since IE 8.

Please see the following articles:

From an article published by Steve Souders at YDN

High Performance Web Sites: Rule 7 – Avoid CSS Expressions

The problem with expressions is that they are evaluated more frequently than most people expect. Not only are they evaluated when the page is rendered and resized, but also when the page is scrolled and even when the user moves the mouse over the page.


From the MSDN:

As of Windows Internet Explorer 8, dynamic properties have been deprecated and are only supported for Web pages displayed in IE5 (Quirks) mode or IE7 Standards mode...

Important

Dynamic properties (also called "CSS expressions") are no longer supported in Internet Explorer 8 and later, in IE8 Standards mode and higher. This decision was made for standards compliance, browser performance, and security reasons


You can see a simple test made to CSS expressions performance here!

查看更多
Juvenile、少年°
3楼-- · 2019-08-11 08:16

http://msdn.microsoft.com/en-us/library/ms537634(v=vs.85).aspx

I think this should be enough to answer. I wouldn't recommend to use them.

查看更多
登录 后发表回答