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

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


Output:
This text has a yellow background color.
hello....