Input的background-image属性的兼容性

一般来说,设置input按钮的background-image属性,在Firefox,Chrome等标准W3C浏览器中,只要写二行css:

1
2
background-image: url(images/hello.jpg);
background-repeat: no-repeat;

但是在IE下,只写上面二行CSS,input元素是不会显示背景图片的,需要写成如下形式,才能正常显示:

1
2
3
4
background-image: url(images/hello.jpg);
background-repeat: no-repeat;
background-color: transparent;
border:none;

其实关键是background-color: transparent,让背景色透明,才能在IE下显示背景图片

posted @ 2013-02-28 20:45  evilfox  阅读(6202)  评论(0编辑  收藏  举报