版本 182927 / background-color

  • 版本网址缩略名: CSS/background-color
  • 版本标题: background-color
  • 版本 id: 182927
  • 创建于:
  • 创建者: Mickeyboy
  • 是否是当前版本?
  • 评论 New page: <breadcrumbs></breadcrumbs> __NOTOC__ {{CSSRef}} == 摘k == <code>background-color</code> sets the background color of an element, either through a color value or the keyword <code>transp...
标签: 

修订内容

{{template.CSSRef()}}

摘k

background-color sets the background color of an element, either through a color value or the keyword transparent.

  • 初始值: transparent
  • 应用于: all elements
  • 继承性: no
  • 百分比: N/A
  • 媒体: visual
  • Computed value: as specified

语法

background-color: color | transparent | inherit

color 
The color can be specified as a hexidecimal RGB value, a regular RGB value, or by using one of the pre-defined color keywords.
transparent 
The default value for background-color is transparent meaning the element has no color of its own, instead showing the color of the element behind it.

例子

{{template.CSSRefExampleLink("background-color")}}

.exampleone {
	background-color: teal;
	color: white;
}

.exampletwo {
	background-color: rgb(153,102,153);
	color: rgb(255,255,204);
}

.examplethree {
	background-color: #666699;
	color: #FFFFFF;
}

提示

(Add links to good colour reference sites here.)

规范

兼容性

TBD: This may be removed in favour of a centralized compatibility chart.

参见

{{wiki.template('CSS_Reference:Background')}}

{{ wiki.languages( { "en": "en/CSS/background-color", "it": "it/CSS/background-color", "pl": "pl/CSS/background-color" } ) }}

修订版来源

<p> 
{{template.CSSRef()}}
</p>
<h3 name=".E6.91.98k"> 摘k </h3>
<p><code>background-color</code> sets the background color of an element, either through a color value or the keyword <code>transparent</code>.
</p>
<ul><li> 初始值: transparent
</li><li> 应用于: all elements
</li><li> 继承性: no
</li><li> 百分比: N/A
</li><li> 媒体: <a href="cn/CSS/Media/Visual">visual</a>
</li><li> Computed value: as specified
</li></ul>
<h3 name=".E8.AF.AD.E6.B3.95"> 语法 </h3>
<pre class="eval">background-color: <i>color</i> | transparent | inherit
</pre>
<h3 name=".E5.80.BC"> 值 </h3>
<dl><dt> color </dt><dd> The color can be specified as a hexidecimal RGB value, a regular RGB value, or by using one of the pre-defined color keywords.
</dd><dt> transparent </dt><dd> The default value for <code>background-color</code> is <code>transparent</code> meaning the element has no color of its own, instead showing the color of the element behind it.
</dd></dl>
<h3 name=".E4.BE.8B.E5.AD.90"> 例子 </h3>
<p>{{template.CSSRefExampleLink("background-color")}}
</p>
<pre>.exampleone {
	background-color: teal;
	color: white;
}

.exampletwo {
	background-color: rgb(153,102,153);
	color: rgb(255,255,204);
}

.examplethree {
	background-color: #666699;
	color: #FFFFFF;
}

</pre>
<h3 name=".E6.8F.90.E7.A4.BA"> 提示 </h3>
<p>(Add links to good colour reference sites here.)
</p>
<h3 name=".E8.A7.84.E8.8C.83"> 规范 </h3>
<ul><li> <a class="external" href="http://www.w3.org/TR/CSS1#background-color">CSS 1</a>
</li><li> <a class="external" href="http://www.w3.org/TR/CSS21/colors.html#propdef-background-color">CSS 2.1</a>
</li><li> <a class="external" href="http://www.w3.org/TR/2005/WD-css3-background-20050216/#background-color">CSS 3</a>
</li></ul>
<h3 name=".E5.85.BC.E5.AE.B9.E6.80.A7"> 兼容性 </h3>
<p>TBD: This may be removed in favour of a centralized compatibility chart.
</p>
<h3 name=".E5.8F.82.E8.A7.81"> 参见 </h3>
<p>{{wiki.template('CSS_Reference:Background')}}
</p>
<div class="noinclude">
</div>
{{ wiki.languages( { "en": "en/CSS/background-color", "it": "it/CSS/background-color", "pl": "pl/CSS/background-color" } ) }}
恢复到这个版本