背景附着 语法如下 : 代码语言:javascript 复制 background-attachment:scroll|fixed background-attachment 属性值设置 :scroll 或 fixed 二选一 ; scroll :背景图像 与 网页内容 绑定 , 网页滚动时 , 背景图像也进行滚动 ; fixed :背景图像 固定 , 滚动网页时 , 背景图像位置保持不变 ; 2、背景固定效果展示 ...
background-attachment 属性 background-attachment:scroll;设置背景图片是否固定。属性值可以是: fixed(背景就会被固定住,不会被滚动条滚走)。 scroll(与fixed属性相反,默认属性) background-attachment:fixed;的效果如下: background 综合属性 background属性和border一样,是一个综合属性,可以将多个属性写在一起。(在...
background-attachment设置背景图像是否固定或者随着页面的其余部分滚动。默认值: scroll 继承: no 版本: CSS1 JavaScript 语法: object object.style.backgroundAttachment="fixed"浏览器支持表格中的数字表示支持该属性的第一个浏览器版本号。紧跟在 -webkit-, -ms- 或 -moz- 前的数字为支持该前缀属性的第一个...
background-attachment : scroll | fixed 1. background-attachment 属性值设置 :scroll 或 fixed 二选一 ; scroll :背景图像 与 网页内容 绑定 , 网页滚动时 , 背景图像也进行滚动 ; fixed :背景图像 固定 , 滚动网页时 , 背景图像位置保持不变 ; ...
前提是定义了background-image属性,然后用background-attachment来指明背景图的位置是固定于视口的,还是随着包含块移动的。可简单理解为定义背景图片随滚动轴的移动方式。 取值: scrool:默认值,背景随页面滚动而移动,即背景和内容绑定。 fixed:背景图相对于视口固定,所以随页面滚动背景不动,相当于背景被设置在了body上...
如果一个元素指定了背景图像,那么background-attachment属性决定背景图像是在视口中固定的,还是跟随包含它的区块进行滚动。 每一个浏览器只有一个视口,当元素的背景图像被设置为固定(fixed)的时候,背景图像不会随着页面内容的滚动而改变它的位置。 如果为某个元素设置了多个背景图像,可以分别为每一个背景图像设置backgro...
1.fixed fixed就是固定的意思,意思页面滚动,背景图不动,相当于背景被设置在了body上。 <!DOCTYPE html> css background-attachment属性例子fixed div { color:#fff; width:300px; height:1024px; background-image: url(/static/default/yxjc/css/good-morning.jpg) ; background-repeat: no-repeat; ...
background-attachment W3C:属性设置背景图像是否固定或者随着页面的其余部分滚动。 属性值: scroll 默认值。背景图像会随着页面其余部分的滚动而移动。 fixed 当页面的其余部分滚动时,背景图像不会移动。 inherit 规定应该从父元素继承 background-attachment 属性的设置。
background-attachment的使用语法 该属性的语法如下: background-attachment: scroll | fixed | initial | inherit 下面的示例演示了如何使用background-attachment属性。 示例 body{background-image:url("images/recycle.jpg");background-attachment: fixed;} ...