多图像背景
title: 多图像背景
tags: css
category: 前端开发
代码如下
body {
background-image: url(/images/background1.png),url(/images/background2.png),url(/images/background3.png),url(/images/background4.png),url(/images/background5.png);
background-repeat: no-repeat,no-repeat,no-repeat,no-repeat,no-repeat; //背景图片不重复
background-attachment: fixed,fixed,fixed,fixed,fixed; //背景图像不跟随移动
background-size: contain,contain,contain,contain,contain; //高和宽都匹配浏览器大小
background-position: 0 0, 27% 0, 54% 0, 81% 0,100% 0; //图片水平方向从左到右
}