color (HTML attribute)

Depr. Version
Yes N/A
Browser support (more…)
IE5.5+ FF1+ SA1.3+ OP9.5+ CH2+
Full Full Full Full Full




The color attribute brightens up the otherwise dull hr element by filling in the hole created by the default beveled appearance.


This code adds a blue horizontal line below the paragraph:

<p>And with that the actress and the bishop made a rather
    nice soufflé.</p>
<hr color="blue"/>
<div id="footer">&copy; All content copyright 2007. Even
    the unfunny stuff.</div>


This attribute takes as its value a recognized color name (for example, "blue" or "red"), or a value specified in hexadecimal notation (such as "#003366"). Note that it’s not possible to use shorthand hexadecimal values in HTML as you can in CSS—for example, you can’t express "#cceeff" as "#cef".


Internet Explorer Firefox Safari Opera Chrome
5.5 6.0 7.0 8.0 1.0 1.5 2.0 3.0 3.5 1.3 2.0 3.1 4.0 9.2 9.5 10.0 2.0
Full Full Full Full Full Full Full Full Full Full Full Full Full None Full Full Full

The hr element display varies between browsers, as is support for the color attribute. While most browsers render the horizontal line with a color, when that attribute is combined with the size attribute, the browsers’ interpretation of color becomes inconsistent. Some display just a colored outline, others fill the space. However, given that color is a deprecated attribute for this element—in fact it was never in any HTML specification to begin with—it’s best to avoid using it altogether, and thereby avoid the potential for validation failure and consistency problems.

User-contributed notes

There are no comments yet.

Related Products