HTML Background
HTML Background
HTML Background Color
HTML Background color is used to give different background colors (like red, green, blue etc.) to any HTML element on the web page.
-
HTML Background Color is defined by style="background-color:value;" syntax.
-
Value can given by color name (like blue), by rgb code (like rgb(255,0,170)) or by Hex code (like #ff22aa).
-
It can be used with any HTML element inside Opening tag.
Example:
<p style="background-color:aqua;">The background color of text becomes aqua.</p>
Example Explanation:
In the above, we have shown an example of HTML Background Color with color name.
-
There are thousands of name of the colors that we can use to give HTML Background Color.
Red
White
Silver
Gray
Yellow
Lime
Green
Aqua
Blue
Purple
-
For More Web Colors
Run the code to see the effect.
Example:
<p style="background-color:rgb(0,255,0);">The background of text color becomes lime.</p>
Example Explanation:
In the above, we have shown an example of HTML Background Color with RGB(Red,Green,Blue) values.
-
There are thousands of rgb values of the colors that we can use to give HTML Background Color.
rgb(255,0,0)
rgb(255,255,255)
rgb(192,192,192)
rgb(128,128,128)
rgb(255,255,0)
rgb(0,255,0)
rgb(0,128,0)
rgb(0,255,255)
rgb(0,0,255)
rgb(128,0,128)
-
For More Web Colors
Run the code to see the effect.
Example:
<p style="background-color:#ffff00;">The background color of text becomes yellow.</p>
Example Explanation:
In the above, we have shown an example of HTML Background Color with Hex values.
-
There are thousands of Hex values of the colors that we can use to give HTML Background Color.
#FF0000
#FFFFFF
#C0C0C0
#808080
#FFFF00
#00FF00
#008000
#00FFFF
#0000FF
#800080
-
For More Web Colors
Run the code to see the effect.