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下显示背景图片


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM