Giving Color to your HTML pages:
coloring text | coloring link | coloring background |
Coloring text
Do you want to give cool color to the text in your webpage? You need two things to change text colors
You need two things:
1. A command to change the text.
2. A color (hex) code.
(1)We can color text using<body> tag:
<body text=red>
(2)coloring text by using the <basefont> or <font> tags
If you want to change some word’s color simply use the attribute “color”
e.g. <basefont color=red>
or
<font color=red>red</font>
<body text=red>
All the text under this body tag is red unless you specify the color using <font> tag.<br>
<font color=blue>This line is inside the <font> tag and color is blue</font><Br>
This is also outside font tag.
</body>
Coloring Links:
If you want to change the color of all links in a webpage, simply use the attribute “link=?”
For example :<body link=blue>
We can give different colors for a visited link and an active link. To set the color of a visited link use the attribute “vlink=?” and to set the color of an active link use the attribute “alink=?”.
<body link=”blue” vlink=”red” alink=”green” border=”0″>
<a href=”html/intro.htm” >Introduction</a><Br>
<a href=”html/basic.htm”>A basic html file</a><Br>
<a href=”html/metatag.htm” >Use of meta tags</a>
</body>
HTML Backgrounds:
A good background can make a Web site look really great. To give a background color to your web page, use this attribute in the <body> tag: “bgcolor=?”
e.g. <body bgcolor=yellow>
Image files as Background:
You can add an image file as background. Assuming that your image is now in the same directory as your HTML document this is the attribute of the <body> tag that you would use:
<body background=”image1.gif”>
If you add bgproperties=”fixed” then the background image won’t scroll.<body background=”image1.gif” bgproperties=”fixed”> . See the example below.