首页
极刻
圈子
教程
开源
登录 / 注册
返回教程:CSS 参考手册
TRY RUN / 在线示例
CSS 参考手册 如何使用像素来定位背景图像
CSS 参考手册 如何使用像素来定位背景图像
源代码
运行
<!DOCTYPE html> <html> <head> <style> body { background-image: url('/statics/images/course/smiley.gif'); background-repeat: no-repeat; background-attachment:fixed; background-position: 50px 100px; } </style> </head> <body> <p><b>Note:</b> For this to work in Firefox and Opera, the background-attachment property must be set to "fixed".</p> </body> </html>
运行结果