共用方式為


background-attachment

important note重要訊息:

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

設定將背景影像附加至文件內物件的方式。

語法

{ background-attachment: sAttachment }

可能的值

sAttachment

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

scroll

預設值。捲動文件時,背景影像會隨著物件捲動。

fixed

背景影像會固定在物件的可檢視區域內。

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

備註

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

範例

下列範例使用 background-attachment 屬性,將背景設定為 fixed ,讓背景不會隨著文字捲動。此範例使用內嵌樣式表將背景設定為 fixed:

<style >
    body { background-attachment: fixed; }
</style>
</head><body background="some.jpg">

標準資訊

您可以在 Cascading Style Sheets (CSS), Level 1 (CSS1) (階層式樣式表 (CSS) 層級 1 (CSS1)) Ee371212.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, iframe, 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, option, p, s, span, sub, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, var, xmp

另請參閱

概念

background
background-color
background-image
background-position
background-repeat