| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
|     <meta charset="UTF-8"> | |
| <title>ie8无法拉伸背景图</title> | |
| <style type="text/css"> | |
| body { | |
| margin: 0; | |
| width: 100%; | |
| height: 462px; | |
|             /* 这么写不显示背景图在 ie8 下 */ | |
|             /*background: url("successed.png")no-repeat;*/ | |
|             /* 这么写就显示背景图了在 ie8 下,看出区别了吗?是的就差一个空格 */ | |
| background: url("successed.png") no-repeat; | |
| background-size: 100% 100%; | |
|         } | |
|     </style> | |
| </head> | |
| <body> | |
| </body> | |
| </html> | 
# 解决方案
- 用 img 标签
| img { | |
| position: fixed; | |
| width: 100%; | |
| height: 100%; | |
| top: 0; | |
| left: 0; | |
| z-index: -1; | |
| } | |
| <img src="successed.png"> | |
| body{ | |
| height:1000px; | |
| /*IE8下的背景渐变*/ | |
| filter:progid:DXImageTransform.Microsoft.Gradient(gradientType=1,startColorStr=#ffffff,endColorStr=#000000); | |
| } | 
