您的位置:首页 > Web前端 > CSS

兼容IE,Firefox 的图片自动缩放CSS及expression用法

2009-07-02 11:00 811 查看
兼容IE、Firefox

img { max-width:200px; max-height:200px; }

*html img { width: expression(this.width > 200 && this.width > this.height ? 200 : auto); height: expression(this.height > 200 ? 200 : auto); } IE7 FF支持max-width\max-height,IE6不支持,FF不支持expression,IE支持。

2. expression例子

鼠标经过时改变颜色 input {star : expression(onmouseover=function(){this.style.backgroundColor=”#FF0000″},onmouseout=function(){this.style.backgroundColor=”#FFFFFF”}) }

<a href=”link1.htm” onfocus=”this.blur()”>link1</a>去除链接虚框

img {margin-top: expression(( 150 - this.height ) / 2);} 图片在容器里垂直居中显示,150是容器高
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: