indiWiz.com
SiteSearch:
Jump:

Site Map | WizTools.org | jCraze Blog
Web Developer's Den!
Home : WDD : html
This Article...
Print Version
Add Comment
View Comments
html
HTML Primer 1
HTML Primer 2
Hyperlinks
Color Guide 1
Color Guide 2
Fonts in HTML
HTML Lists
Table Tutor 1
Table Tutor 2
HTMLfx
HTML Special Characters
HTML Editors
Animation and HTML
XHTML - The Bare Facts
Sections

Commniquè
Sign Guestbook!
Read Guestbook!
MailMe!

Subhash's Guide to Color Coding - II: Add Color

Background

Background color/picture should not be painful to the eyes. Light color/picture is preferable(not always although!) and the text should be readable.

Background Color

In the <body> tag add the attribute:

bgcolor="color-value"

Now the <body> tag looks like:

<body bgcolor="color-value">

If you do not know what color-value is, check out the Color Guide I.

Background Graphics

To the <body> tag add the attribute:

background="path/to/the/graphic"

Now the <body> tag looks like:

<body background="path/to/the/graphic">

The graphic format supported currently by major browsers are JPG, GIF & PNG. The graphic will tile using this method. And yes, you can keep animated gifs as background(yuck!).

Non-Tile Background

Attach the following CSS code to the <body>:

background-image: url(path/to/the/graphic); background-repeat: no-repeat

The graphic wll be placed in the top-left corner of your document. Other values the attribute "background-repeat" can have are "repeat-x" (one horizontal stripe of background image displayed in the top), "repeat-y" (one vertical stripe of background image displayed from the top) and "repeat".

Non-Scroll Background

This can be achieved by this CSS code (which should be attached to the <body> tag):

background-attachment: fixed

The other value for this attribute is "scroll".

Text Color

To change the default text color of black, include the following attribute in the <body> tag:

text="color-value"

You also have the independence to change the default font & the size of such font:

<basefont face="font-name" size="size number">

This is a singleton tag & it can be placed within the <body> element.

Using <font>

The <font> tag can be used to change the color, font & size of text. Consider I have the following text:

Subhash is a good boy!

Now if I have to make the word 'good' blue, I did put the code as follows:

Subhash is a <font color="blue">good</font> boy!

The result is:

Subhash is a good boy!

The <font> tag can be used for interesting effects:

"Her eyes revealed the deepness of eternity!"

In the above example each letter is wrapped in a <font> tag using the color attribute, each having a different color value.

The simplicity & advantages associated with CSS (Cascading Style Sheets) has virtually replaced the usage of the <font> tag. Using CSS the 'Subhash is a good boy!' example can be written as follows:

Subhash is a <span style="color:blue">good</span> boy!

Link Color

To change the link color include the following attributes to the <body>:

link="color-value"Specifies the link color
alink="color-value"Specifies the activated link color
vlink="color-value"Specifies the visited link color

The same can be achieved in CSS thus:

a:link{color:color-value}
a:visited{color:color-value}
a:active{color:color-value}

"color-value" should be replaced by the actual color code or name.

While you browsed you would have seen links that change color when you bring the mouse over it. For achieving this, just add this code in your CSS declaration:

a:hover{color:color-value}


User Comments

Add Comment

[Quick Stats: Number of main threads: 1, Number of sub-threads: 0]


Sign Guestbook | Who is Subhash?
The contents of this site are copyright© 2000-2008, indiWiz.com. All Rights Reserved.