background-repeat

important note重要訊息:

本文件為初步資訊而且可能隨時變更。

設定物件之 background-image 屬性的並排顯示方式。

語法

{ background-repeat: sRepeat }

可能的值

sRepeat

指定下列其中一個值的字串:

repeat

預設值。水平及垂直重複影像。

no-repeat

不重複影像。

repeat-x

水平重複影像。

repeat-y

垂直重複影像。

此屬性的預設值為 repeat 。這不是繼承屬性。

備註

repeat-xrepeat-y 值分別會水平和垂直重複影像,從一邊到另一邊將影像排列成一整排。

使用 background 複合屬性,即可連同其他背景屬性一併設定此屬性。

範例

下列範例使用 background-repeat 屬性來指定是否拼貼背景影像。此範例會呼叫內嵌 (全域) 樣式表來拼貼影像:

<style>
    .style1 {background-image: url(sphere.jpg);
        background-repeat: repeat}
    .style2 {background-image: url(sphere.jpeg);
        background-repeat: no-repeat; }
</style>
</head>
<body>
<span onmouseover="this.className='style1'"
      onmouseout="this.className='style2'"
      onclick="this.className=''">
. . . 
</span>  

標準資訊

您可以在 Cascading Style Sheets (CSS), Level 1 (CSS1) (階層式樣式表 (CSS) 層級 1 (CSS1)) Ee371237.xtlink_newWindow(zh-tw,Expression.40).png 找到此屬性的定義。

適用範圍

a, address, b, big, blockquote, body, button, caption, center, cite, code, col, colgroup, custom, dd, defaults, dfn, div, dl, dt, em, fieldset, form, hn, html, i, img, input type=button, input type=checkbox, input type=file, input type=image, input type=password, input type=radio, input type=reset, input type=submit, input type=text, li, ol, p, s, span, sub, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, var, xmp

另請參閱

概念

background
background-image