英 [ˈbækgraʊnd] 美 [ˈbækˌɡraʊnd]
n.(画等的)背景;底色;背景资料;配乐
复数: backgrounds
javascript background属性 语法
作用:设置所有的背景属性。
语法:Object.style.background=background-color background-image,background-repeat ,background-attachment ,background-position
参数:background-color 设置元素的背景色。background-image 设置背景图像。background-repeat 设置背景图像是否及如何重复。 background-attachment 背景图像是否固定或者随着页面的其余部分滚动。background-position 设置背景图像的起始位置。
javascript background属性 示例
<html> <head> <script type="text/javascript"> function setStyle() { document.body.style.background="#FFCC80 url(http://img.php.cn/upload/article/000/005/656/5af270fd37755429.jpg) repeat-y"; } </script> </head> <body> <input type="button" onclick="setStyle()" value="Set background style" /> </body> </html>
运行实例 »
点击 "运行实例" 按钮查看在线实例
热门推荐
- 【CSS3】-background-origin background-clip background-size_html/css_WEB-ITnose
- CSS3教程:background-clip和background-origin
- css background-image和layer-background-image的区别
- background-origin和background-clip的区别_html/css_WEB-ITnose
- firefox不支持background-position-x background-position-y,使用background-position:5px 5px;_html/css_WEB-ITnose
- CSS中background什么意思?background用法详解