CSS expressions (CSS expression) is a very powerful method that allows you to dynamically set attributes on a page, but it has poor compatibility and also has a terrible weakness;
You can use a function expression in Javascript in CSS expressions. To dynamically set the page style. It can also solve some experience in earlier ie browsers.
Supporter: ie5 to IE7 browser.
For example, IE6 does not support applying the height: 100% attribute of position: absolute. Available:Height: expression (it. parentnode. offsetheight + 'px ';);
For example, you can use CSS expressions to control the color changes every hour:Background-color: expression (new date (). gethours () % 2? "# B8d4ff": "# f08a00 ");
However, this method has a terrible hidden danger. It will frequently calculate (beyond the expectation of most designers );
In the following cases, CSS expressions are frequently executed.
1. When the webpage is opened. (<10 times)
2. Reset the browser size each time. (Once)
3. Pull and set the browser size. (One pixel per pull)
4. Move the mouse over the text area on the page (one pixel per mouse)
When the CSS expressions page is used, the CSS expression is easily calculated for tens of thousands of times, leading to machine slowdown, browser freezing, and high CPU occupation.
Demo of the number of tests and computations (see IE6 and IE7 .)
Therefore, if the page style attribute must be set dynamically, you can use JavaScript to implement it. CSS expressions is not recommended;
If you must use a CSS expression, do not forget that it may generate thousands of computations at the same time.
Affects the effect of your entire page;