background-color

設定物件內容後方的色彩。

語法

{ background-color: sColor }

可能的值

sColor

指定下列其中一個值的變數:

transparent

預設值。下一個父物件的色彩,可透過該色彩看見背景。

color

任何有效的 HTML 色彩值。

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

備註

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

範例

下列範例使用 background-color 屬性來指定背景色彩。此範例使用內嵌樣式表將背景色彩設為 beige

<span style="font-size: 14pt; background-color: beige;">
. . . 
</span>

標準資訊

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

另請參閱

概念

background
色彩