css background-color property


  Translation results:

background

UK[ˈbækgraʊnd] US[ˈbækˌɡraʊnd]

n. (Painting, etc.) background; background color; background information; soundtrack

Plural: backgrounds

color

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

n.<美>Color, tint; skin color, complexion, blood color; pigment, dye; essence

v.<Beauty> Color...; change the color of...; whitewash, render, color; blush

Third person singular: colors Plural: colors Present participle: coloring Past tense: colored Past participle: colored

css background-color propertysyntax

How to use the background-color attribute?

The background-color attribute is used to set the background color (solid color) of the element. The syntax is: background-color: color value. This color fills the element's content, padding, and border areas, extending to the outer bounds of the element's border (but not the margins).

Function: Set the background color of the element.

Description: The background-color attribute sets a solid color for the element. This color fills the element's content, padding, and border areas, extending to the outer bounds of the element's border (but not the margins). If the border has transparent parts (such as a dotted border), the background color will show through these transparent parts.

Note: The attribute value "inherit" is not supported in any version of Internet Explorer (including IE8).

css background-color propertyexample

<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>
Run instance »

Click the "Run instance" button to view the online instance

Popular Recommendations

Home

Videos

Q&A