Webmaster Resources Center

Welcome to the Bravenet Resource Center. Use these resources to help make your web pages more advanced and fun to use.

Articles & Tutorials

The Body Tag; Deprecated Attributes

by Roger Riche

Summary : A lot of the websites you see out there have a lot of attributes in their BODY tag, but how many of those attributes are actually valid; bgcolor; alink; link.. How about none of the above?

A deprecated element or attribute of html means that the element or attribute has been tagged to be removed from future versions of the html language but is still accessible for backwards compatibility. It is strongly advised to not use any tag or attribute that is deprecated.

The body tag contains several deprecated attributes that people are still guilty of using and should veer away from. The following is a list of deprecated BODY tag attributes:

  • link: Used to specify the color of your page links.
  • vlink: Sets the visited link color.
  • alink: Sets the active link color.
  • bgcolor: Sets the page's background color.
  • text: Sets the default color of your body text.

Here is an example of an HTML tag using deprecated attributes. Avoid using the attributes in the example:

<body alink="red" vlink="maroon" link="blue" text="black" bgcolor="white" background="title.jpg">

Above, we've set the style for common webpage elements. You can achieve the same thing properly by using CSS. In the <head> of your HTML document, place this style sheet:

<style type="text/css">
color: black;
background-color: white;
background-image: url('title.jpg');
color: blue;
color: maroon;
color: red;

With the above style in the HEAD of your document, your BODY tag should now look like: <body> -- no more attributes.

That's it! You have converted your html to use proper html by removing the deprecated attributes in your body tag. There are many other deprecated attributes that have CSS alternative. We will touch base on in another article.

Happy coding!