What’s an HTML color tag?

Print anything with Printful



Color tags in HTML specify the color of text, borders, or backgrounds. They are largely deprecated in favor of style sheets, but still recognized by most browsers. Color can be specified by name, hexadecimal code, or RGB values. The color tag can be used for links, backgrounds, borders, and table cells. Web-safe colors may not display the same on all monitors and operating systems.

A color tag is an HTML element that specifies the color of something, such as text, border or background. The use of color tags in HTML is largely deprecated in favor of using style sheets, but most browsers will recognize color tags when used in HTML on a page. In CSS, the color tag is used regularly, and several CSS tutorials discuss how to leverage the color tag to achieve a specific look and feel.

When a color tag is used, there are several options for specifying the color. One is simply to name the color, such as “black” or “blue.” Another is to use a six-digit hexadecimal code that specifies a particular color, like #FFFFFF for white, although people should be aware that sometimes these codes display differently in different browsers when it comes to dark colors. Another option is to use an RGB color, where the levels of red, green, and blue are specified, such as 0,0,0 for black.

An example of one way the color tag was used was in text coloring, as in . For hexadecimal codes, the format would be used, while RGB codes would be written as All these values ​​for the color tag are just examples; you can find charts with lists of color options online. This trick could also be used to color links, by nesting the “font color=” specification inside the link, as in: wiseGEEK. For backgrounds, the HTML would read . The color element can also be used in code that specifies the characteristics of a border or cell within a table.

Before the color tag was deprecated, it was also used in “body” tags for specific documents. These tags can set attributes for the entire page, allowing people to set background color, link color, text color, visited link color, and so on.

216 colors are considered web-safe, meaning that when used with color tags, they should display the same on any monitor. As many people have learned, however, the situation is a little more complicated. Colors can appear very different on different monitors, and it’s worth testing a website with different monitors to get an idea of ​​the color spectrum that might be seen. Different operating systems can also have problems with some colors, and some browsers reject colors altogether, meaning similar hues can start to blur together when rendered in grayscale.




Protect your devices with Threat Protection by NordVPN


Skip to content