CSS background-attachment的功能说明
background-attachment属性的功能: 用于设置背景图像是否滚动 注意事项: 此处的滚动指背景图片是否随着页面滚动而滚动 如:固定背景图片在指定位置,即可以使用此属性例
//固定背景图像
body {
background-image: url("test.png");
background-repeat: no-repeat;
background-position: right top;
background-attachment: fixed;
}
//背景图像随页面其余部分一起滚动
body {
background-image: url("test.png");
background-repeat: no-repeat;
background-position: right top;
background-attachment: scroll;
}