经常用到css中背景图片居中显示,记录下,直接上代码:
[code] height: 100%;width: 100%;background-image: url(\"图片地址\");background-repeat: no-repeat;background-position-x: center;background-position-y: center;background-size: 100% 100%;
如果要保持图片的宽高比,将 background-size: 100% 100%; 改成 background-size: contain;