可以使用background-size:contain代替,这样图片就会在完全覆盖背景的同时,保持其原始比例。另外,也可以尝试缩小背景图片的尺寸,或者使用更小的文件大小的图片。示例代码如下:
background: url('image.jpg') no-repeat center center fixed; -webkit-background-size: contain; -moz-background-size: contain; -o-background-size: contain; background-size: contain;
上一篇:背景图片渐变消失
下一篇:背景图片拉伸和不透明度不起作用