Thursday, June 11, 2009

Expressions in CSS

Ever heard of IE’s CSS “expression” property? It allows you to set a CSS property not to a constant, but to the result of a JavaScript expression. Like this:


p
{
width:expression(400 + "px");
}


p
{
max-width:800px;
width:expression(document.body.clientWidth > 800? "800px": "auto" );
}

No comments:

Post a Comment