HTML and CSS Reference
In-Depth Information
HTML Attribute
Used On
CSS Property
a:visited {color: value ;}
vlink
body
a:active {color: value ;}
alink
body
a:link {color: value ;}
link
body
background
body
background-image
The most common place to see colors set is on the <body> start-tag. For example, some pages specify black
text on a white background:
<body bgcolor="#FFFFFF" text="#000000">
This is easily replaced with this CSS rule:
body { color: #000000;
background-color: #FFFFFF; }
CSS supports the same hexadecimal values for color properties as HTML does, so you can just copy the old
HTML attribute values into the CSS properties. Of course, if you like, feel free to upgrade to HTML 4/CSS named
colors instead. For example:
body { color: black;
background-color: white; }
You also can specify the vlink , alink , and link attributes of the body element in CSS using the same color
property. You simply apply the color to the pseudoclasses :visited , :active , and :link instead of to an
element. For example:
*:vlink { color: green; }
*:alink { color: red; }
*:link { color: yellow; }
However, in this case I'll make a strong suggestion that you simply delete these attributes without replacing
them in CSS. Standard colors that don't change from one site to the next help users to recognize links.
Changing link colors makes your site harder to navigate. A discontinuity in color schemes between the link
colors and everything else on your site is a small price to pay for assisting users with navigating your site.
If a font element specifies the colors, you may need to replace that element with a span element to have
someplace to put the color. Follow the instructions in the previous section.
When invoked with the -clean option, Tidy will define replacement CSS classes and insert matching rules in a
style element in the head. For example, it changes this:
<body bgcolor="#FFFFFF" text="#000000">
<h2><font color="#AA0000">Today's News</font></h2>
into this:
 
Search WWH ::




Custom Search