CSS Color Properties

1. Color

This property defines foreground color or text color.

Color values can be:
  • Color name - like “orange”
  • HEX value - like “#ff0000”
  • RGB value - like “rgb(255,0,0)”

2. Background

The CSS background properties are used to define the background effect for element.

The properties of CSS background are :
  • background-color
  • background-image
  • background-repeat
  • background-attachment
  • background-position

Example: Demonstration of color property

               <p style = "background-color:yellow;">
               This text has a yellow background color.</p>
               <p style ="color: blue;">

This text has a yellow background color.