企业🤖AI Agent构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
## background-attachment属性 background-attachment设置背景图像是否固定或者随着页面的其余部分滚动。 JavaScript 语法:object object.style.backgroundAttachment="fixed" ***** 属性值 | 值 | 说明 | | :-- | :-- | | scroll | 背景图片随页面的其余部分滚动。这是默认 | | fixed | 背景图像是固定的 | | inherit | 指定background-attachment的设置应该从父元素继承 | | local | 背景图片随滚动元素滚动 | **实例--如何指定一个固定的背景图像:** ``` <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>W3Cschool教程(w3cschool.cn)</title> <style> body { background-image:url('/statics/images/w3c/logo.png'); background-repeat:no-repeat; } </style> </head> <body> <p>The background-image is fixed. Try to scroll down the page.</p> <p>The background-image is fixed. Try to scroll down the page.</p> <p>The background-image is fixed. Try to scroll down the page.</p> <p>The background-image is fixed. Try to scroll down the page.</p> <p>The background-image is fixed. Try to scroll down the page.</p> <p>The background-image is fixed. Try to scroll down the page.</p> <p>The background-image is fixed. Try to scroll down the page.</p> <p>The background-image is fixed. Try to scroll down the page.</p> <p>The background-image is fixed. Try to scroll down the page.</p> <p>The background-image is fixed. Try to scroll down the page.</p> <p>The background-image is fixed. Try to scroll down the page.</p> <p>The background-image is fixed. Try to scroll down the page.</p> <p>The background-image is fixed. Try to scroll down the page.</p> <p>The background-image is fixed. Try to scroll down the page.</p> <p>The background-image is fixed. Try to scroll down the page.</p> </body> </html> ```