There are three ways of how you can change the color of the
text in HTML. these are basic color code..
0 = Black 8 = Gray
1 = Blue 9 = Light Blue
2 = Green A = Light Green
3 = Aqua B = Light Aqua
4 = Red C = Light Red
5 = Purple D = Light Purple
6 = Yellow E = Light Yellow
7 = White F = Bright White
Colors are very important to give a good look and feel to
your website. You can specify colors on page level using <body> tag or
you can set colors for individual tags using bgcolor attribute.
The <body> tag has following attributes which can be
used to set different colors −
bgcolor − sets a color for the background of the page.
text − sets a color for the body text.
alink − sets a color for active links or selected
links.
link − sets a color for linked text.
vlink − sets a color for visited links − that
is, for linked text that you have already clicked on.
HTML Color Coding Methods
There are following three different methods to set colors in
your web page −
Color names − You can specify color names directly like green, blue or red.
Hex codes − A six-digit code representing the amount of red, green, and blue that makes up the color.
Color decimal or percentage values − This value is specified using the rgb( ) property.
Now we will see these coloring schemes one by one.
HTML Colors - Color Names
You can specify direct a color name to set text or
background color. 16 basic color names that will validate with an HTML
validator but there are over 200 different color names supported by major
browsers.
Example :-
<html>
<head>
<title>HTML
Colors by RGB code</title>
</head>
<body text = "rgb(0,0,255)"
bgcolor = "rgb(0,255,0)">
<p>Use
different color code for for body and table and see the result.</p>
<table bgcolor
= "rgb(0,0,0)">
<tr>
<td>
<font
color = "rgb(255,255,255)">This text will appear white on black
background.</font>
</td>
</tr>
</table>
</body>
</html>
No comments:
Post a Comment
Please do not enter any Link in the comment box.