background

英 [ˈbækgraʊnd]   美 [ˈbækˌɡraʊnd]  

n.(画等的)背景;底色;背景资料;配乐

复数: backgrounds

color

英 ['kʌlə(r)]   美 [ˈkʌlɚ]  

n.<美>颜色,色彩;肤色,脸色,血色;颜料,染料;本质

v.<美>给…涂颜色;改变…的颜色;粉饰,渲染,使带上色彩;脸红

第三人称单数: colors 复数: colors 现在分词: coloring 过去式: colored 过去分词: colored

css background-color属性 语法

background-color属性怎么用

background-color属性用来设置元素的背景颜色(纯色),语法为:background-color:颜色值。这种颜色会填充元素的内容、内边距和边框区域,扩展到元素边框的外边界(但不包括外边距)。

作用:设置元素的背景颜色。

说明:background-color 属性为元素设置一种纯色。这种颜色会填充元素的内容、内边距和边框区域,扩展到元素边框的外边界(但不包括外边距)。如果边框有透明部分(如虚线边框),会透过这些透明部分显示出背景色。

注释:任何版本的 Internet Explorer (包括 IE8)都不支持属性值 "inherit"。

css background-color属性 示例

<html>
<head>
<style type="text/css">
body {background-color: yellow}
h1 {background-color: #00ff00}
h2 {background-color: transparent}
p {background-color: rgb(250,0,255)}
p.no2 {background-color: gray; padding: 20px;}
</style>
</head>
<body>
<h1>这是标题 1</h1>
<h2>这是标题 2</h2>
<p>这是段落</p>
<p class="no2">这个段落设置了内边距。</p>
</body>
</html>
运行实例 »

点击 "运行实例" 按钮查看在线实例

热门推荐