HTML & CSS Wiki
Advertisement

The background-color property is used in CSS and some special HTML tags to create a background color of a particular object. The overall effect without any borders or curved edges will be like highlighted text. You can customize the background-color property with the border-radius and -moz-border-radius properties.

To apply this in the HTML document, use:

<span style="background-color:white; color:black;">See the bg</span>

That will make this: See the bg. The color property is used to specify the color of the text. Notice how the background color only wraps around the text, leaving no extra padding.

To apply this in a CSS document, use this on any particular element you want, like the h1 element:

h1 {
     background-color:white;
     color:black;
}

Any color will work, as well as HTML color codes (#000000, #666666, #999999, #CCCCCC, etc).

See Also[]

background-image

Advertisement