Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

HTML Basics: Backgrounds and Colors : Page 2

Add background color and images to your page and change your text color.


advertisement
Backgrounds, Colors, and the Body Tag

<body background="URL" bgcolor="colorvalue" text="colorvalue" link="colorvalue" vlink="colorvalue">
</body>

Browsers are set to use their own default colors—typically a gray background, black text, blue links, and purple visited links. Unless you specify otherwise in your HTML file, these are the colors which your page will display. Pretty 1994, eh?



You may, however, specify backgrounds, background colors, and link colors with the <body> tag. Remember, a start body tag goes at the beginning of your page's content; an ending body tag goes at the end of your file. Everything between the start and end body tags appears in the web browser.

The body tag does two things:

  1. Tells the browser that everything between the start body tag at the beginning of the file and the end body tag at the end of the file is part of the displayable page.
  2. Sets various page-wide values, which override the default browser values.

This is the body tag for the page you are reading right now:

<body bgcolor="#f5f5f5" text="000000" link="chocolate" vlink="chocolate">

You can see the result it produces -- an off-white background, black text, and a chocolate color for both links and visited links.

Body Tag Attributes