CSS background-attachment 属性


实例

如何指定一个固定的背景图像:

body
{
background-image:url('smiley.gif');
background-repeat:no-repeat;
background-attachment:fixed;
}

尝试一下 »

标签定义及使用说明

background-attachment设置背景图像是否固定或者随着页面的其余部分滚动。

默认值: scroll
继承: no
版本: CSS1
JavaScript 语法: object object.style.backgroundAttachment="fixed"


浏览器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

所有主要浏览器都支持background-attachment属性。


属性值

说明
scroll 背景图片随页面的其余部分滚动。这是默认
fixed 背景图像是固定的
inherit 指定background-attachment的设置应该从父元素继承


相关文章

CSS 教程: CSS Background