Using CSS to avoid tags deprecated in HTML4

You've already seen how to alter the <BODY> tag to include details normally declared in the HTML. This is included in the CSS file because HTML4 dictates that the normal text= and bgcolor= attributes are "deprecated" - not needed and likely to be unsupported in future releases of HTML. There are other BODY attributes that are deprecated, the alink=, link= and vlink= attributes. These cannot be amended by the CSS BODY selector - you need to use a pseudo-class to include these in CSS

a:link{color:red;background-color:white;}
a:visited{color:green;background-color:white;}
a:active{color:black;background-color:white;}

Equivalent to the attributes: link=red vlink=green alink=black in the normal BODY tag.

Remember, for files shared with non-CSS capable browsers, you may need to include the deprecated <BODY> attributes temporarily. Don't neglect the text-justification and font selection of the main BODY selector - these will add to the presentation of the site in those browsers that support CSS but will cause no problems in non-CSS browsers, so go ahead and include them in all your HTML.



This is part of www.codehelp.co.uk Copyright © 1998-2004 Neil Williams
See the file about.html for copying conditions.