英 [ˈ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>运行实例 »
点击 "运行实例" 按钮查看在线实例
热门推荐
- html5紫色怎么加深_html5用CSS调color或background的RGB加深紫色【加深】
- css浮动导致背景图位置偏移怎么办_检查background-origin与padding并使用clearfix稳定背景包裹
- css背景图模糊看不清如何处理_css背景模糊问题可用background-size优化
- css背景图需要慢慢移动营造景深效果如何做_利用background-position动画完成平移
- css表格首行背景色渐变如何实现_使用::first-row和background-color
- css多列列表隔行不同背景色如何实现_使用:nth-child和background-color