1. Computing

Discuss in my forum

background-color

By , About.com Guide

background-color Description:

The background-color property defines the background color of the element.

background-color in CSS Versions:

background-color Syntax:

background-color: <color> | transparent | inherit

  • <color>
    The color of the background.
  • transparent
    Takes the same color as the element below it.
  • inherit
    The element should have the same background-color setting as the parent.

background-color Initial Value:

transparent

background-color Applies To:

All elements.

background-color Inheritance:

This property is not inherited.

background-color Browser Support:

background-color Examples:

Standard background-color property

<p style="background-color : #ccc;">
 This paragraph has a grey background.
 </p>

transparent background

<p style="background-color : transparent;">
 This paragraph will have the same background color as whatever is below it in z-index.
 </p>

background-color Special Notes:

  • background-color can be defined as hexadecimal (#ff0000), RGB (rgb(255,0,0)), or background-color names (red).
  • Be careful using the "transparent" value with Netscape - it sometimes translates that as black (#000 or rgb(0%,0%,0%)).
  • It's a good idea to style the color of your text when you use a dark background color.

More background-color Information:

©2013 About.com. All rights reserved.