CSS Behaviors vs CSS Expressions

In follow-up to my previous post, one thing that is worth mentioning is behaviors should always be preferred over expressions. Why? Expressions are constantly re-evaluated making slow Internet Explorer even slower.

For example, an expression doing a faux “max-width” would be recalculated hundreds of times when the mouse moves, even though the result would always be the same. The advantage of behaviours is that you can bind them to specific events, page load, window resize, etc, and in doing so reduce cpu load and improve the performance of your site.

Comments are closed.

The All Knowing Trash Heap