运行 ❯
获取您
自有
网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <head> <style> .fixed-bg { background-image: url("img_tree.gif"); min-height: 500px; background-attachment: fixed; background-position: center; background-repeat: no-repeat; background-size: cover; } </style> </head> <body> <p>In this example, we have created a fixed background image that will disappear slowly on scroll. Scroll the page to see the effect. <strong>Note:</strong> Try to remove the background-attachment property to really understand this example.</p> <div class="fixed-bg"></div> <div style="height:800px;background-color:yellow;">This div is only here to enable scrolling (height = 800 pixels).</div> </body> </html>