CSS Background Color

How to set the background color for html tags using style sheet?
How to assign background color for few words?

Explanation

Property:

BackGround Color

Usage:


background-color: red;
background-color: #343434;
background-color: transparent;

Definition:

Background Color in html can be set using the css property background-color.
It accepts values in two formats
a) Color name
b) #xxyyz where xx,yy,zz points to hexadecimal values of red,green,blue
c) Transparent background can also be set in css.

Examples


Example 1:


<font style="background-color: green;"> color name </font>
Result:

color name

Example 2:


<font style="background-color: #888888;"> html text background using css</font>
Result:

html text background using css

Example 3:


<font style="background-color: transparent; color:green;"> transparent backgrounds can also be given using css</font>
Result:

transparent backgrounds can also be given using css

Ask Questions

Ask Question