设置网页背景图片平铺方式 background-repeat 属性

Sets or retrieves how the backgroundImage property of the object is tiled.

Syntax

HTML { background-repeat : sRepeat }
Scripting object.style.backgroundRepeat [ = sRepeat ]

Possible Values

sRepeat String that specifies or receives one of the following values.
repeat Default. Image is repeated horizontally and vertically.
no-repeat Image is not repeated.
repeat-x Image is repeated horizontally.
repeat-y Image is repeated vertically.

The property is read/write for all objects except the following, for which it is read-only: currentStyle. The property has a default value of repeat. The Cascading Style Sheets (CSS) attribute is not inherited.

Expressions can be used in place of the preceding value(s), as of Microsoft® Internet Explorer 5. For more information, see About Dynamic Properties.

例子:

.bg{
 background-attachment: scroll;
 background-image: url(../image/bg.png);
 background-repeat: repeat-x;
 background-position: center top;
 background-color: #cee6f3;
}

 

 

阅读更多

没有更多推荐了,返回首页