CSS 背景图随div大小缩放 兼容IE

让背景图片的大小自动适应DIV大小,兼容主流浏览器,包括Firefox、Chrome以及IE等:

.imgDiv{
    width:500px;
    height:500px;
    background-image:url('../images/index.jpg');
    -moz-background-size: 100% 100%;  
    -o-background-size: 100% 100%;  
    -webkit-background-size: 100% 100%;  
    background-size: 100% 100%;  
    -moz-border-image: url(./btn.png) 0;  
    background-repeat:no-repeat\9;  
    background-image:none\9;
           
filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../images/index.jpg', sizingMethod='scale')\9;
}

相关推荐